Plan struct colon access as get_field - #25373
Open
osipovartem wants to merge 3 commits into
Open
osipovartem wants to merge 3 commits into
osipovartem wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25373 +/- ##
=======================================
Coverage 81.93% 81.93%
=======================================
Files 1136 1136
Lines 429152 429233 +81
Branches 429152 429233 +81
=======================================
+ Hits 351633 351705 +72
- Misses 56475 56481 +6
- Partials 21044 21047 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Which issue does this PR close?
Closes no issue.
Rationale for this change
SqlToRel::parse_json_accessrepresents SQL colon access as a colon binary operator. For an Arrow Struct, that expression currently retains the complete Struct type and reaches an unsupported physical binary operator instead of accessing the requested field.What changes are included in this PR?
NestedFunctionPlannernow lowers a static colon access on a Struct to the existing vectorizedget_fieldUDF. Nested paths become nestedget_fieldcalls, which the existing simplifier can flatten and push toward scan leaves. Non-Struct colon expressions remain available to other planners.The tests cover nested Struct access and the non-Struct fallback.
Are there any user-facing changes?
SQL JSON-style access on typed Struct expressions can now be planned and executed through
get_field.How was this change tested?
cargo test -p datafusion-functions-nested planner::tests --lib(2 passed)cargo fmt --all -- --checkA package clippy run reached an unrelated pre-existing
from_iter_instead_of_collectwarning indatafusion/common/src/scalar/mod.rs; the changed crate passed this same focused clippy command on the DataFusion 55 fork.