-
Notifications
You must be signed in to change notification settings - Fork 2.3k
refactor: move lambda variable scope into Physical Planning Context #23989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b38dfa
refactor: move lambda evaluation into Physical Planning Context
sweb 1bc2fff
Merge branch 'main' into refactor/move-lambda-eval
sweb 678073f
chore: address review comments
sweb 37de280
Merge branch 'main' into refactor/move-lambda-eval
sweb 6de3485
Merge branch 'main' into refactor/move-lambda-eval
sweb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -740,14 +740,19 @@ unit is truncated -- so `time(s) + interval '1 nanosecond'` is a no-op. | |
|
|
||
| See [PR #23279](https://github.com/apache/datafusion/pull/23279) for details. | ||
|
|
||
| ### Scalar-subquery state moved to an explicit `PhysicalPlanningContext` | ||
| ### Physical-planning state moved to an explicit `PhysicalPlanningContext` | ||
|
|
||
| The `subquery_indexes` and `subquery_results` public fields on | ||
| `datafusion_expr::execution_props::ExecutionProps` have been removed. They were | ||
| added in `54.0.0` as the channel through which the physical planner passed | ||
| uncorrelated scalar-subquery state to functions that create physical | ||
| `Arc<dyn PhysicalExpr>` values from logical `Expr` values. | ||
|
|
||
| The `lambda_variable_qualifier` public field and the | ||
| `with_qualified_lambda_variables` method on `ExecutionProps` have been removed | ||
| for the same reason: they carried the qualifiers of the lambda variables in | ||
| scope while `create_physical_expr` descended into a lambda body. | ||
|
|
||
| That state is now carried by a dedicated | ||
| `datafusion_expr::physical_planning_context::PhysicalPlanningContext` passed explicitly | ||
| through functions and planner traits. Unlike `ExecutionProps`, which applies | ||
|
|
@@ -790,6 +795,14 @@ Convenience methods such as `SessionContext::create_physical_expr` and | |
| parameter and forward it. | ||
| - Code that read or wrote `execution_props.subquery_indexes` / | ||
| `execution_props.subquery_results`: build a `PhysicalPlanningContext` instead. | ||
| - Code that read `execution_props.lambda_variable_qualifier` or called | ||
| `ExecutionProps::with_qualified_lambda_variables`: remove that usage. Callers | ||
| that only plan a `HigherOrderFunction` are not affected -- | ||
| `create_physical_expr` populates the lambda qualifiers itself as it descends | ||
| into lambda bodies. Code that needs to read or extend the lambda | ||
| scope should use the equivalents on `PhysicalPlanningContext`: | ||
| `PhysicalPlanningContext::lambda_variable_qualifier` and | ||
| `PhysicalPlanningContext::with_qualified_lambda_variables`. | ||
|
Comment on lines
+798
to
+805
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed in 678073f |
||
|
|
||
| **Migration guide:** | ||
|
|
||
|
|
@@ -833,7 +846,8 @@ async fn plan_extension( | |
| } | ||
| ``` | ||
|
|
||
| See [PR #23649](https://github.com/apache/datafusion/pull/23649) for details. | ||
| See [PR #23649](https://github.com/apache/datafusion/pull/23649) and | ||
| [PR #23989](https://github.com/apache/datafusion/pull/23989) for details. | ||
|
|
||
| ### Catalog, planner, and optimizer contracts moved to `datafusion-session` | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this concern holds up - this is planning time and once per lambda - not per row. Also, I would not expect massive parameter lists of lambdas or lambda chains - from my point of view due to the Arc this has already reduced clone cost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your points, this is minor, and the existing code already performs the full clone anyway. It also would require changing the received
planning_ctxto a mutable&mut PhysicalPlanningContext