Skip to content

feat(core): add LambdaBuilder for build-time lambda validation#2

Merged
limameml merged 7 commits intolimameml:limame.malainine/add-lambda-supportfrom
substrait-io:benbellick/proposed-lambda-validation-impl
Mar 17, 2026
Merged

feat(core): add LambdaBuilder for build-time lambda validation#2
limameml merged 7 commits intolimameml:limame.malainine/add-lambda-supportfrom
substrait-io:benbellick/proposed-lambda-validation-impl

Conversation

@benbellick
Copy link

@benbellick benbellick commented Mar 16, 2026

WIP: Adds LambdaBuilder, a context-aware builder that validates lambda parameter references at build time. Mirrors the lambdaContext stack pattern from substrait-go. The builder maintains a parameter stack, pushing/popping around body construction so that stepsOut is computed automatically from the difference between the current stack depth and the depth when the scope was created. Nested lambdas use the same lb.lambda() call as root lambdas.

ProtoExpressionConverter now uses LambdaBuilder for lambda parameter validation during deserialization, replacing the private LambdaParameterStack inner class.

Tests are split across three files:

  • LambdaBuilderTest: validates the builder API directly (valid construction and invalid parameter index errors)
  • LambdaExpressionRoundtripTest: parameterized JSON-based tests that auto-discover fixtures from expressions/lambda/valid/ and expressions/lambda/invalid/
  • LambdaExpressionTest (isthmus): Calcite roundtrip tests including arithmetic function bodies

Built on top of substrait-io#710.
Ref substrait-io#688

…ameter references

Introduces LambdaBuilder, a context-aware builder that maintains a lambda
parameter stack (lambdaContext) to validate parameter references at build
time. Nested lambdas use the same builder, ensuring stepsOut is computed
automatically. Mirrors the lambdaContext pattern from substrait-go.
Moves ProtoExpressionConverter to use LambdaBuilder for lambda parameter
validation, removing the private LambdaParameterStack. Replaces builder-based
roundtrip tests with parameterized JSON fixtures in expressions/lambda/.
Adds arithmetic body test to isthmus LambdaExpressionTest.
@benbellick benbellick force-pushed the benbellick/proposed-lambda-validation-impl branch from e8543d8 to 67c5a8a Compare March 16, 2026 21:45
@benbellick benbellick marked this pull request as ready for review March 17, 2026 13:30
@limameml limameml merged commit 0dd2114 into limameml:limame.malainine/add-lambda-support Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants