From 0007a75d63b5d04b406986d0ed6b4040394cee20 Mon Sep 17 00:00:00 2001 From: jackwener Date: Fri, 25 Mar 2022 15:07:50 +0800 Subject: [PATCH] *: remove duplicate test --- datafusion/src/optimizer/simplify_expressions.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datafusion/src/optimizer/simplify_expressions.rs b/datafusion/src/optimizer/simplify_expressions.rs index 5927810da5512..8e1e7d319e8e7 100644 --- a/datafusion/src/optimizer/simplify_expressions.rs +++ b/datafusion/src/optimizer/simplify_expressions.rs @@ -1034,6 +1034,11 @@ mod tests { let expr = call_fn("to_timestamp", vec![col("a")]).unwrap(); test_evaluate(expr.clone(), expr); + // check that non foldable arguments are folded + // to_timestamp(a) --> to_timestamp(a) [no rewrite possible] + let expr = call_fn("to_timestamp", vec![col("a")]).unwrap(); + test_evaluate(expr.clone(), expr); + // volatile / stable functions should not be evaluated // rand() + (1 + 2) --> rand() + 3 let fun = BuiltinScalarFunction::Random; @@ -1046,7 +1051,6 @@ mod tests { // parenthesization matters: can't rewrite // (rand() + 1) + 2 --> (rand() + 1) + 2) let fun = BuiltinScalarFunction::Random; - assert_eq!(fun.volatility(), Volatility::Volatile); let rand = Expr::ScalarFunction { args: vec![], fun }; let expr = (rand + lit(1)) + lit(2); test_evaluate(expr.clone(), expr);