None of the interval year to month operators for division, multiplication, subtraction and addition check boundaries, so this problem is not specific to multiplication. Also, similar boundary checks should be added for multiplication by double.
This is true for any functional environment of Presto.
Expected Behavior
It should be an error to exceed the boundary of the interval type. The underlying datastructure for interval year to month is an integer, so we should raise an error for any value that exceed's Java integer range.
Current Behavior
The interval will silently overflow and return incorrect results.
Possible Solution
Modify the interval operators to do proper overflow checking, as is done for e.g. INTEGER operators.
Steps to Reproduce
See the above queries for a simple reproduction.
Screenshots (if appropriate)
Context
This was discovered while converting constant folding of expressions to use Velox for their evaluation.
This produces the correct value:
The next higher number will overflow:
None of the interval year to month operators for division, multiplication, subtraction and addition check boundaries, so this problem is not specific to multiplication. Also, similar boundary checks should be added for multiplication by double.
Likewise, the interval day time operators will also overflow and need the same checks, adjusted to work for the long type that backs IntervalDayTimeType.
Your Environment
This is true for any functional environment of Presto.
Expected Behavior
It should be an error to exceed the boundary of the interval type. The underlying datastructure for interval year to month is an integer, so we should raise an error for any value that exceed's Java integer range.
Current Behavior
The interval will silently overflow and return incorrect results.
Possible Solution
Modify the interval operators to do proper overflow checking, as is done for e.g.
INTEGER
operators.Steps to Reproduce
See the above queries for a simple reproduction.
Screenshots (if appropriate)
Context
This was discovered while converting constant folding of expressions to use Velox for their evaluation.
This was previously reported in #9342.