retikulum commented on issue #3615:
URL: 
https://github.com/apache/arrow-datafusion/issues/3615#issuecomment-1276565586

   Hi @HaoYang670, Thanks for your reply. You can find my comments about issues.
   
   1. I just wrote this piece of code with its test:
   ```
               // A / 0 --> DivideByZeroError 
               BinaryExpr {
                   left: _,
                   op: Divide,
                   right,
               } if is_zero(&right) => {
                   return 
Err(DataFusionError::ArrowError(ArrowError::DivideByZero))
               }
   ```
   ```
       #[test]
       #[should_panic(
           expected = "called `Result::unwrap()` on an `Err` value: 
ArrowError(DivideByZero)"
       )]
       fn test_simplify_divide_by_zero() {
           let expr = binary_expr(col("c2_non_null"), Operator::Divide, lit(0));
   
           simplify(expr);
       }
   ```
   2. I am not sure if I understood correctly but can't we check it with the 
following control ```!( is_zero(&left) && is_zero(&right) )```  ? You mentioned 
about performance concerns above 
(https://github.com/apache/arrow-datafusion/issues/3615#issuecomment-1259181235)
 so I am not sure what to do about it.


-- 
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]

Reply via email to