You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/02 04:12:24 UTC

[GitHub] [arrow-datafusion] HaoYang670 commented on issue #1727: Remove duplicate tests in `test_const_evaluator_scalar_functions`

HaoYang670 commented on issue #1727:
URL: https://github.com/apache/arrow-datafusion/issues/1727#issuecomment-1027559822


   Another that I find
   https://github.com/apache/arrow-datafusion/blob/master/datafusion/src/optimizer/simplify_expressions.rs#L1042-L1054
   ```rust
           // volatile / stable functions should not be evaluated
           // rand() + (1 + 2) --> rand() + 3
           let fun = BuiltinScalarFunction::Random;
           assert_eq!(fun.volatility(), Volatility::Volatile);
           let rand = Expr::ScalarFunction { args: vec![], fun };
           let expr = rand.clone() + (lit(1) + lit(2));
           let expected = rand + lit(3);
           test_evaluate(expr, expected);
   
   
           // parenthesization matters: can't rewrite
           // (rand() + 1) + 2 --> (rand() + 1) + 2)
           let fun = BuiltinScalarFunction::Random;
           assert_eq!(fun.volatility(), Volatility::Volatile);
   ```
   
   We test `BuiltinScalarFunction::Random.volatility()` twice.


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

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