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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
