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-unsubscr...@datafusion.apache.org.apache.org

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


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

Reply via email to