feat(pojo): support ExecutionContextVariable (#802)#867
Open
nielspardon wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the
Expression.ExecutionContextVariablemessage introduced in Substrait v0.87.0, modeling the three execution-context-dependent variables as POJO expressions:CURRENT_TIMESTAMP(CurrentTimestamp, carries a fractional-secondprecision)CURRENT_TIMEZONE(CurrentTimezone)CURRENT_DATE(CurrentDate)All three implement a shared
ExecutionContextVariablemarker interface (extendingExpression, mirroring theLiteral/Nested/Subqueryprecedent). Per the spec, each is a leaf expression whose result type always hasNULLABILITY_REQUIREDnullability.Resolves #802 (part of the v0.87.0 epic #790; sibling to the
ExecutionBehaviorwork in #791).Changes
Expression.java): marker interface + three@Value.Immutableclasses.visitmethods onExpressionVisitor, fallback defaults onAbstractExpressionVisitor, and handlers in the direct implementors (ExpressionProtoConverter,ExpressionCopyOnWriteVisitor, examplesExpressionStringify).ExpressionProtoConverter; proto→POJOEXECUTION_CONTEXT_VARIABLEcase inProtoExpressionConverter.ExpressionCreatorfactories andSubstraitBuilderDSL helpers (currentTimestamp(precision),currentTimezone(),currentDate()).ExecutionContextVariableRoundtripTestcoveringgetType()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-sparkall pass.🤖 Generated with AI