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

Optimize cast(xx as Decimal) to avoid redundancy overflow check #3721

Closed
windtalker opened this issue Dec 23, 2021 · 0 comments · Fixed by #3912
Closed

Optimize cast(xx as Decimal) to avoid redundancy overflow check #3721

windtalker opened this issue Dec 23, 2021 · 0 comments · Fixed by #3912
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement. type/performance

Comments

@windtalker
Copy link
Contributor

Enhancement

Our current implementation of cast(xx as Decimal) will check overflow for each input, actually, if source is a acurate type, we can use meta data to check if this cast can overflow, for example,
cast(int64 to Decimal(20,0))
Since the length of Int64.max_value/Int64.min_value is 20, when casting Int64 to Decimal(20,0), it should never overflow, so there is no need to check overflow for every input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement. type/performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants