Skip to content

perf: resolve aliased field once during metadata inference - #26156

Open
osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:upstream-alias-single-field
Open

osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:upstream-alias-single-field

Conversation

@osipovartem

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Related to #24264. This isolates the alias single-resolution optimization from the broader, closed #24316.

Rationale for this change

Deriving a field for nested aliases resolves each child twice: once through metadata() and once through to_field(). Since metadata() itself calls to_field(), the work grows exponentially with alias depth. This affects schema inference and planning; no row execution path changes.

What changes are included in this PR?

Resolve the aliased child field once and read its metadata from that same field before applying explicit alias metadata. A 12-level regression test records 4,096 source-field lookups before the change and one after it, while checking metadata override, preserved metadata, output name, type, and nullability.

What is the testing strategy for this PR?

  • cargo fmt --all --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test -p datafusion-expr --lib (282 passed)
  • Full documented extended workspace command with initialized test-data submodules and Arrow/Parquet fixtures (passed)
  • Independent read-only review: approved with no blocking findings.

Are there any user-facing changes?

No schema or API behavior change; this reduces planning cost.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.11111% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.77%. Comparing base (06aa131) to head (982f93b).

Files with missing lines Patch % Lines
datafusion/expr/src/expr_schema.rs 86.11% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26156      +/-   ##
==========================================
- Coverage   82.77%   82.77%   -0.01%     
==========================================
  Files        1147     1147              
  Lines      450909   450940      +31     
  Branches   450909   450940      +31     
==========================================
+ Hits       373252   373267      +15     
- Misses      54934    54946      +12     
- Partials    22723    22727       +4     

☔ 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

logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants