Skip to content

feat(core): support ExecutionContextVariable#867

Merged
nielspardon merged 1 commit into
substrait-io:mainfrom
nielspardon:feat/execution-context-variable
Jun 19, 2026
Merged

feat(core): support ExecutionContextVariable#867
nielspardon merged 1 commit into
substrait-io:mainfrom
nielspardon:feat/execution-context-variable

Conversation

@nielspardon

Copy link
Copy Markdown
Member

Summary

Adds support for the Expression.ExecutionContextVariable message introduced in Substrait v0.87.0, modeling the three execution-context-dependent variables as POJO expressions:

  • CURRENT_TIMESTAMP (CurrentTimestamp, carries a fractional-second precision)
  • CURRENT_TIMEZONE (CurrentTimezone)
  • CURRENT_DATE (CurrentDate)

All three implement a shared ExecutionContextVariable marker interface (extending Expression, mirroring the Literal/Nested/Subquery precedent). Per the spec, each is a leaf expression whose result type always has NULLABILITY_REQUIRED nullability.

Resolves #802 (part of the v0.87.0 epic #790; sibling to the ExecutionBehavior work in #791).

Changes

  • POJO model (Expression.java): marker interface + three @Value.Immutable classes.
  • Visitor: new visit methods on ExpressionVisitor, fallback defaults on AbstractExpressionVisitor, and handlers in the direct implementors (ExpressionProtoConverter, ExpressionCopyOnWriteVisitor, examples ExpressionStringify).
  • Proto conversion: POJO→proto in ExpressionProtoConverter; proto→POJO EXECUTION_CONTEXT_VARIABLE case in ProtoExpressionConverter.
  • Ergonomics: ExpressionCreator factories and SubstraitBuilder DSL helpers (currentTimestamp(precision), currentTimezone(), currentDate()).
  • Tests: ExecutionContextVariableRoundtripTest covering getType() and POJO↔proto round-trip for all three variants.

Verification

:core:test, :core:spotlessCheck, and compilation of :isthmus, :spark:spark-3.5_2.12, and :examples:substrait-spark all pass.

🤖 Generated with AI

@nielspardon nielspardon changed the title feat(pojo): support ExecutionContextVariable (#802) feat(core): support ExecutionContextVariable (#802) Jun 16, 2026
@nielspardon nielspardon changed the title feat(core): support ExecutionContextVariable (#802) feat(core): support ExecutionContextVariable Jun 17, 2026
Add CURRENT_TIMESTAMP, CURRENT_TIMEZONE, and CURRENT_DATE execution
context variables as POJO expressions, modeled under a shared
ExecutionContextVariable marker interface. Each is a leaf expression
whose result type has NULLABILITY_REQUIRED nullability per the Substrait
spec.

Includes visitor support (ExpressionVisitor / AbstractExpressionVisitor
and direct implementors), bidirectional protobuf conversion, and
ExpressionCreator / SubstraitBuilder helpers, plus a round-trip test.
@nielspardon nielspardon force-pushed the feat/execution-context-variable branch from 13c3c16 to 0ea8686 Compare June 17, 2026 13:17
@nielspardon nielspardon merged commit a649e0d into substrait-io:main Jun 19, 2026
13 checks passed
@nielspardon nielspardon deleted the feat/execution-context-variable branch June 19, 2026 12:55
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.

add ExecutionContextVariable support (CURRENT_DATE, CURRENT_TIMESTAMP, CURRENT_TIMEZONE)

2 participants