fix: support CAST/TRY CAST expressions for return_field_from_args - #24334
fix: support CAST/TRY CAST expressions for return_field_from_args#24334dd-annarose wants to merge 1 commit into
Conversation
Functions like date_part require the value of one of their arguments to determine their return type. This commit adds support for CAST/TRY_CAST in addition to Literal values. This change is required as constant-folding cannot run before analysis. It casts logical fields once (not per row) so there is no impact in terms of performance.
bcc580c to
14b61b5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24334 +/- ##
==========================================
- Coverage 81.29% 81.14% -0.16%
==========================================
Files 1110 1112 +2
Lines 385336 386940 +1604
Branches 385336 386940 +1604
==========================================
+ Hits 313261 313967 +706
- Misses 53594 54478 +884
- Partials 18481 18495 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
i dont think the linked issue is correct here? i also dont see the rationale for this change, it seems odd to allow a |
|
@Jefffrey ah yes, the issue is not correct, I misread. Postgres does support |
Which issue does this PR close?
Rationale for this change
Functions like date_part require the value of one of their arguments to determine their return type.
This PR adds support for CAST/TRY_CAST in addition to Literal values.
This change is required as constant-folding cannot run before analysis. It casts logical fields once (not per row) so there is no impact in terms of performance.
Are these changes tested?
Yes,
date_part.slthas been updated with two tests.Are there any user-facing changes?
No.