feat: add Plan.ExecutionBehavior support#224
Open
nielspardon wants to merge 1 commit into
Open
Conversation
Exposes the plan-level execution behavior introduced in Substrait 0.87.0
(Plan.execution_behavior.variable_eval_mode), which governs how often
execution context variables (current_timestamp / current_date /
current_timezone) are evaluated -- once per plan or once per record.
- builders.plan.with_execution_behavior(plan, variable_eval_mode) sets it
- execution behavior is now carried over by every relational builder (folded
into the renamed _merge_plan_metadata helper), so it survives subsequent
operations and is order independent across a pipeline
- DataFrame.with_execution_behavior("per_plan" | "per_record") wires it into
the native fluent frame
Resolves substrait-io#185.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tokoko
reviewed
Jul 19, 2026
|
|
||
| return self._next(resolve) | ||
|
|
||
| def with_execution_behavior(self, mode: str) -> "DataFrame": |
Contributor
There was a problem hiding this comment.
mode feels too generic here, maybe variable_eval_mode?
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.
What
Adds support for the plan-level execution behavior introduced in Substrait 0.87.0 (
Plan.execution_behavior.variable_eval_mode). This is the last open sub-issue of #161; the companionExecutionContextVariablesupport (#186) is already merged.variable_eval_modecontrols how often execution context variables (current_timestamp/current_date/current_timezone) are evaluated — once per plan (VARIABLE_EVALUATION_MODE_PER_PLAN) or once per record (VARIABLE_EVALUATION_MODE_PER_RECORD).Changes
builders.plan.with_execution_behavior(plan, variable_eval_mode)— setsPlan.execution_behavioron a copy of the plan._merge_extensions, renamed to_merge_plan_metadata). As a result the setting survives subsequent operations and is order-independent across a pipeline, instead of only surviving as the last step.DataFrame.with_execution_behavior("per_plan" | "per_record")— wires it into the native fluent frame, following the existing string→enum convention (_JOIN_TYPES,_CREATE_MODES, …).Test plan
tests/builders/plan/test_with_execution_behavior.py: set/preserve-relations/no-input-mutation, propagation through a later builder, first-input-wins for multi-input builders, last-wins overwrite, unset-by-default.tests/dataframe/test_frame.py: both modes, preserved-through-later-ops, set mid-chain, invalid-mode error, and an end-to-end pairing withcurrent_timestamp.ruff checkandruff format --checkclean.Resolves #185.
🤖 Generated with AI