You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "davidhewitt (via GitHub)" <gi...@apache.org> on 2025/04/15 09:46:13 UTC
[I] Interval arithmetic `apply_operator` does not support OR [datafusion]
davidhewitt opened a new issue, #15715:
URL: https://github.com/apache/datafusion/issues/15715
### Describe the bug
Originally requested in https://github.com/apache/datafusion/issues/7883, which got closed by https://github.com/apache/datafusion/pull/8276
Looks like that PR added support to `OR` to `propagate_constraints` but missed OR out of `apply_operator` (which is used by `evaluate_bounds`) - https://github.com/apache/datafusion/blob/e9b9645ca0da5c6ce3d1e7d8210e442cf565cea0/datafusion/expr/src/interval_arithmetic.rs#L773-L787
Seems like this should just be added?
### To Reproduce
```
#[test]
fn test_evaluate_bounds_bool() -> Result<()> {
let schema = Schema::new(vec![
Field::new("a", DataType::Boolean, false),
Field::new("b", DataType::Boolean, false),
]);
let a = Arc::new(Column::new("a", 0)) as _;
let b = Arc::new(Column::new("b", 1)) as _;
// Test OR bounds - currently not working
let or_expr = binary_expr(Arc::clone(&a), Operator::Or, Arc::clone(&b), &schema)?;
let or_bounds = or_expr.evaluate_bounds(&[
&Interval::make(Some(true), Some(true))?,
&Interval::make(Some(false), Some(false))?,
])?;
assert_eq!(or_bounds, Interval::make(Some(true), Some(true))?);
// Test AND bounds - working fine
let and_expr =
binary_expr(Arc::clone(&a), Operator::And, Arc::clone(&b), &schema)?;
let and_bounds = and_expr.evaluate_bounds(&[
&Interval::make(Some(true), Some(true))?,
&Interval::make(Some(false), Some(false))?,
])?;
assert_eq!(and_bounds, Interval::make(Some(false), Some(false))?);
Ok(())
}
```
### Expected behavior
Looks like this test should pass.
### Additional context
I have a PR to fix, will submit shortly.
--
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
Re: [I] Interval arithmetic `apply_operator` does not support OR [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #15715: Interval arithmetic `apply_operator` does not support OR
URL: https://github.com/apache/datafusion/issues/15715
--
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
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