feat: add implicit native coercion constructor - #24282
Open
Jamison929611 wants to merge 1 commit into
Open
Conversation
Author
|
The substantive GitHub Actions workflows are currently marked |
jayzhan211
approved these changes
Aug 12, 2026
Contributor
|
FYI @Jefffrey you may be interested in this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24282 +/- ##
==========================================
- Coverage 81.29% 81.28% -0.01%
==========================================
Files 1110 1110
Lines 385205 385223 +18
Branches 385205 385223 +18
==========================================
+ Hits 313145 313147 +2
- Misses 53580 53593 +13
- Partials 18480 18483 +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?
Coercion::new_implicitis confusing when desired type isTypeSignatureClass::Native#24135.Rationale for this change
When a coercion's desired type is a native logical type, callers currently have to repeat that type as both
TypeSignatureClass::Native(...)anddefault_casted_type. This duplication is confusing and can allow the two values to disagree.What changes are included in this PR?
Coercion::new_implicit_native, which derivesdefault_casted_typefrom the desired logical type and delegates to the existingnew_implicitconstructor.Coercion::new_implicitunchanged for backward compatibility and non-native desired type classes.reverseandapprox_percentile_contcall sites linked from the issue.Coercionrustdoc example and add a constructor-equivalence unit test.Are these changes tested?
Yes:
cargo test -p datafusion-expr-common test_new_implicit_native --libcargo test -p datafusion-functions reverse --libcargo test -p datafusion-functions-aggregate approx_percentile_cont --libcargo test -p datafusion-expr-common --doccargo clippy -p datafusion-expr-common -p datafusion-functions -p datafusion-functions-aggregate --all-targets --all-features -- -D warningscargo fmt --allThe required full-workspace
cargo clippy --all-targets --all-features -- -D warningswas also attempted on Windows. It reached an unrelated MSVC native-link failure while buildingprotobuf-src(LNK2005/LNK4098inprotoc-gen-upb); affected-crate clippy passed with warnings denied, and CI will run the full Linux workspace checks.No benchmark was run because this is an API convenience constructor that delegates to the existing constructor and does not change runtime execution.
Are there any user-facing changes?
Yes. This adds the public
Coercion::new_implicit_nativeconvenience API. It is additive and backward compatible; existingnew_implicitcallers continue to work unchanged.