You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "benbellick (via GitHub)" <gi...@apache.org> on 2026/09/21 15:58:40 UTC

[I] `satisfy_greater` panics at composite interval component boundaries [datafusion]

benbellick opened a new issue, #25573:
URL: https://github.com/apache/datafusion/issues/25573

   ### Describe the bug
   
   `satisfy_greater` panics when strict inequality propagation needs the successor or predecessor of a valid `IntervalDayTime` or `IntervalMonthDayNano` value whose smallest component is at its numeric boundary.
   
   The Arrow format [represents `IntervalDayTime` as two signed 32-bit integers](https://github.com/apache/arrow/blob/081b4022fe6f659d8765efc82b3f4787c5039e3c/format/Schema.fbs#L406-L408), and Arrow Rust [accepts any `i32` value for each component without normalization](https://github.com/apache/arrow-rs/blob/ef1fa157977633f0ba21aa921f9ef3d5c669235b/arrow-buffer/src/interval.rs#L323-L377). Therefore, `(0, i32::MAX)` is a valid representation.
   
   The [adjacent-value implementation](https://github.com/apache/datafusion/blob/31a4ca07fe1f874a5dec3dc79f4e53b8107a5a20/datafusion/expr-common/src/interval_arithmetic.rs#L1232-L1344) increments or decrements only the smallest component. [`satisfy_greater` calls it directly](https://github.com/apache/datafusion/blob/31a4ca07fe1f874a5dec3dc79f4e53b8107a5a20/datafusion/expr-common/src/interval_arithmetic.rs#L1427-L1445), resulting in an `IntervalDayTime overflow` panic.
   
   ### To Reproduce
   
   ```rust
   use datafusion_common::{
       arrow::datatypes::IntervalDayTime,
       ScalarValue,
   };
   use datafusion_expr_common::interval_arithmetic::{
       satisfy_greater,
       Interval,
   };
   
   fn scalar(days: i32, milliseconds: i32) -> ScalarValue {
       ScalarValue::IntervalDayTime(Some(IntervalDayTime::new(
           days,
           milliseconds,
       )))
   }
   
   fn main() -> datafusion_common::Result<()> {
       let left =
           Interval::try_new(scalar(0, i32::MIN), scalar(1, i32::MAX))?;
       let right =
           Interval::try_new(scalar(0, i32::MAX), scalar(1, i32::MAX))?;
   
       satisfy_greater(&left, &right, true); // This panics.
   
       Ok(())
   }
   ```
   
   The process panics with:
   
   ```text
   IntervalDayTime overflow
   ```
   
   ### Expected behavior
   
   `satisfy_greater` should return a `Result` rather than panic. The implementation could handle component boundaries or return an error when an adjacent value cannot be computed.
   
   `IntervalMonthDayNano` has the analogous problem at nanosecond and day boundaries.
   
   ### Additional context
   
   Found while investigating #25344.
   
   Interval-typed expressions are currently excluded from physical constraint propagation, so this is reproducible through the public Rust API rather than an SQL query.
   


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org