Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(expr): support user-defined CAST and TRY_CAST #6663

Merged
merged 3 commits into from
Jul 22, 2022

Conversation

andylokandy
Copy link
Contributor

@andylokandy andylokandy commented Jul 17, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • Support CAST and TRY_CAST
  • Allow cast between any number types. Once precision downgrade is detected during evaluation, while CAST will abort the execution and throw an error, TRY_CAST will just silently replace that single scalar with NULL.
  • Note that TRY_CAST will wrap its dest type into nullable. For example, the return type of TRY_CAST(a AS Int8) is Int8 NULL, and the return type of TRY_CAST(a AS Array(Int8)) is Array(Int8 NULL) NULL.

Tracked in #6547

@vercel
Copy link

vercel bot commented Jul 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Jul 21, 2022 at 7:27PM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Jul 17, 2022
@andylokandy andylokandy marked this pull request as ready for review July 20, 2022 07:58
@andylokandy andylokandy requested review from sundy-li and leiysky July 20, 2022 08:03
@BohuTANG
Copy link
Member

Please take a review @leiysky @sundy-li

@BohuTANG BohuTANG requested a review from sundy-li July 22, 2022 00:03
@BohuTANG BohuTANG merged commit 9a5885d into databendlabs:main Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants