From aaf116b7a96fac7a1a4ffe902cfbb85d6be67ac2 Mon Sep 17 00:00:00 2001 From: Christoph Schulze Date: Fri, 14 Feb 2025 21:07:27 +0100 Subject: [PATCH] revisit union interval logic --- datafusion/expr-common/src/interval_arithmetic.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/datafusion/expr-common/src/interval_arithmetic.rs b/datafusion/expr-common/src/interval_arithmetic.rs index 6157e16b1bc1..ddba0cd391fc 100644 --- a/datafusion/expr-common/src/interval_arithmetic.rs +++ b/datafusion/expr-common/src/interval_arithmetic.rs @@ -646,8 +646,9 @@ impl Interval { }; // If the intervals overlap or touch, return a single merged interval - if (self.is_not_null() && rhs.is_not_null()) && self.upper >= rhs.lower - || rhs.upper >= self.lower + if self.is_not_null() + && rhs.is_not_null() + && (self.upper >= rhs.lower || rhs.upper >= self.lower) { return Ok(Some(Self::new(lower_bound.unwrap(), upper_bound.unwrap()))); }