Skip to content

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

@windtalker

Description

@windtalker

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions