Repository navigation
refactor: share the REPLACE and validation steps of the wildcard arms in project_with_validation - #26312
Conversation
… in project_with_validation Closes #26308
|
@alamb Friendly ping when you have a moment: this small refactor is mergeable and ready for review. Happy to change anything. |
|
@andygrove can you please help review this PR as you filed the issue request? |
andygrove
left a comment
There was a problem hiding this comment.
LGTM. I read the whole diff and the refactor preserves behaviour: the REPLACE step, the normalize-then-columnize step and the order of operations are unchanged. The borrows are sound, including opt.replace now being borrowed with .as_ref(). cargo check -p datafusion-expr passes on the PR head. I did not run the tests or clippy locally, so I'm relying on CI for those.
Two optional nits, neither blocking:
- The
push_validatedclosure holds&mutborrows ofprojected_exprandnormalizer, so nothing in the loop body can read them later. A small private helper function would avoid that. apply_replaceis a thin wrapper around anOptionmatch.replace_columnscould takeOption<&PlannedReplaceSelectItem>directly. The wildcard and qualified-wildcard arms still repeat the same expand, apply_replace,try_for_eachchain, which could share a tail after the match.
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26312 +/- ##
==========================================
- Coverage 82.80% 82.79% -0.01%
==========================================
Files 1149 1149
Lines 454146 454146
Branches 454146 454146
==========================================
- Hits 376035 376030 -5
- Misses 55260 55261 +1
- Partials 22851 22855 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@andygrove Thanks for reading the whole diff so carefully! I'll keep the two nits in mind and leave this PR as is, unless you'd prefer them here. |
|
A follow on sounds good. Thank you @ozenyunus35 and @andygrove |
Which issue does this PR close?
Rationale for this change
The
WildcardandQualifiedWildcardarms ofproject_with_validationrepeated the same REPLACE handling and the same normalize/columnize step, and theExpressionarm repeated that step a third time.What changes are included in this PR?
push_validatedclosure in the loop does the normalize/columnize (or pass-through) push, and all three arms use it.apply_replacehelper applies a wildcard's REPLACE clause if there is one.Each wildcard arm now only computes its expansion. No behaviour change.
What is the testing strategy for this PR?
Covered by existing tests: the builder unit tests in
datafusion-exprand the wildcard /REPLACEcases inselect.slt,unnest.slt,functions.sltandaggregate.slt, which all pass locally.Are there any user-facing changes?
No.
I used an AI assistant to help draft parts of the code; I reviewed the changes and ran the tests myself.