You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "dd-annarose (via GitHub)" <gi...@apache.org> on 2026/08/13 16:17:51 UTC
[PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
dd-annarose opened a new pull request, #24334:
URL: https://github.com/apache/datafusion/pull/24334
## Which issue does this PR close?
- Closes #24133.
## 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.slt` has been updated with two tests.
## Are there any user-facing changes?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24334:
URL: https://github.com/apache/datafusion/pull/24334#issuecomment-5283712522
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/24334?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 81.14%. Comparing base ([`9b3b518`](https://app.codecov.io/gh/apache/datafusion/commit/9b3b518950c0c6a564b5525d6b274000f27dccd9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`14b61b5`](https://app.codecov.io/gh/apache/datafusion/commit/14b61b5acde2368af6c27e1d065494d11361f488?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 13 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ 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
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/24334?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #24334:
URL: https://github.com/apache/datafusion/pull/24334#issuecomment-5290257924
i dont think the linked issue is correct here?
i also dont see the rationale for this change, it seems odd to allow a `cast` expression when we expect a literal; is there a usecase that requires this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
Posted by "dd-annarose (via GitHub)" <gi...@apache.org>.
dd-annarose commented on PR #24334:
URL: https://github.com/apache/datafusion/pull/24334#issuecomment-5295014955
@Jefffrey ah yes, the issue is not correct, I misread.
Postgres does support `SELECT date_part(CAST('year' as VARCHAR), now());` and it feels like a good addition to DataFusion. If constant-folding was happening before `date_part` had to determine its return type, it wouldn't be an issue because of the constant-folding. So it seems like a good addition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #24334:
URL: https://github.com/apache/datafusion/pull/24334#issuecomment-5307672212
im just not sure on adding this logic if we dont have a strong usecase for it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix: support CAST/TRY CAST expressions for return_field_from_args [datafusion]
Posted by "dd-annarose (via GitHub)" <gi...@apache.org>.
dd-annarose closed pull request #24334: fix: support CAST/TRY CAST expressions for return_field_from_args
URL: https://github.com/apache/datafusion/pull/24334
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org