Skip to content

Plan struct colon access as get_field - #25373

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

osipovartem wants to merge 4 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 79.51807% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.45%. Comparing base (7570366) to head (87cf279).

Files with missing lines Patch % Lines
datafusion/sql/src/expr/mod.rs 79.51% 8 Missing and 9 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25373      +/-   ##
==========================================
- Coverage   82.45%   82.45%   -0.01%     
==========================================
  Files        1140     1140              
  Lines      436589   436653      +64     
  Branches   436589   436653      +64     
==========================================
+ Hits       359996   360036      +40     
- Misses      54838    54851      +13     
- Partials    21755    21766      +11     

☔ 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.

@github-actions github-actions Bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) and removed functions Changes to functions implementation labels Sep 22, 2026
@osipovartem
osipovartem force-pushed the upstream-struct-colon-get-field branch from 2dd5ed9 to 529a724 Compare September 22, 2026 23:04
@osipovartem
osipovartem force-pushed the upstream-struct-colon-get-field branch from 529a724 to 87cf279 Compare September 23, 2026 07:10
@github-actions github-actions Bot added the core Core DataFusion crate label Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants