Skip to content

Plan struct colon access as get_field - #25373

Open
osipovartem wants to merge 3 commits into
apache:mainfrom
Embucket:upstream-struct-colon-get-field
Open

osipovartem wants to merge 3 commits into
apache:mainfrom
Embucket:upstream-struct-colon-get-field

Conversation

@osipovartem

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes no issue.

Rationale for this change

SqlToRel::parse_json_access represents 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?

NestedFunctionPlanner now lowers a static colon access on a Struct to the existing vectorized get_field UDF. Nested paths become nested get_field calls, 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 -- --check

A package clippy run reached an unrelated pre-existing from_iter_instead_of_collect warning in datafusion/common/src/scalar/mod.rs; the changed crate passed this same focused clippy command on the DataFusion 55 fork.

@github-actions github-actions Bot added the functions Changes to functions implementation label Sep 16, 2026
@codecov-commenter

codecov-commenter commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.12195% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.93%. Comparing base (140c7c5) to head (af03520).

Files with missing lines Patch % Lines
datafusion/functions-nested/src/planner.rs 95.12% 1 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants