haohuaijin commented on code in PR #25234:
URL: https://github.com/apache/datafusion/pull/25234#discussion_r3999302739
##########
datafusion/expr-common/src/interval_arithmetic.rs:
##########
@@ -422,9 +422,43 @@ impl Interval {
data_type: &DataType,
cast_options: &CastOptions,
) -> Result<Self> {
+ let source_type = self.data_type();
+ // An unbounded integer endpoint still has a finite limit imposed by
its
+ // type. Preserve that limit when widening so subsequent arithmetic can
+ // prove that it does not overflow the destination type.
+ use DataType::{Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32,
UInt64};
+ let widening_integer_cast = matches!(
+ (&source_type, data_type),
+ (Int8, Int16 | Int32 | Int64)
+ | (Int16, Int32 | Int64)
+ | (Int32, Int64)
+ | (UInt8, UInt16 | UInt32 | UInt64 | Int16 | Int32 | Int64)
+ | (UInt16, UInt32 | UInt64 | Int32 | Int64)
+ | (UInt32, UInt64 | Int64)
+ );
+ let lower = if widening_integer_cast && self.lower.is_null() {
+ get_extreme_value!(
+ MIN,
+ MIN_DECIMAL128_FOR_EACH_PRECISION,
+ MIN_DECIMAL256_FOR_EACH_PRECISION,
+ &source_type
+ )
+ } else {
+ self.lower.clone()
+ };
+ let upper = if widening_integer_cast && self.upper.is_null() {
+ get_extreme_value!(
+ MAX,
+ MAX_DECIMAL128_FOR_EACH_PRECISION,
+ MAX_DECIMAL256_FOR_EACH_PRECISION,
+ &source_type
+ )
+ } else {
+ self.upper.clone()
+ };
Review Comment:
This addresses the [CI
timeout](https://github.com/apache/datafusion/actions/runs/34702765587/job/103578173073):
lost bounds blocked join pruning, leaving the FIFO test waiting for output.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]