MCPcopy Create free account
hub / github.com/apache/datafusion / fold_and_simplify

Function fold_and_simplify

datafusion/core/tests/expr_api/simplification.rs:175–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173
174#[test]
175fn fold_and_simplify() {
176 let context = SimplifyContext::builder().with_schema(schema()).build();
177
178 // What will it do with the expression `concat('foo', 'bar') == 'foobar')`?
179 let expr = concat(vec![lit("foo"), lit("bar")]).eq(lit("foobar"));
180
181 // Since datafusion applies both simplification *and* rewriting
182 // some expressions can be entirely simplified
183 let simplifier = ExprSimplifier::new(context);
184 let simplified = simplifier.simplify(expr).unwrap();
185 assert_eq!(simplified, lit(true))
186}
187
188#[test]
189/// Ensure that timestamp expressions are folded so they aren't invoked on each row

Callers

nothing calls this directly

Calls 8

newFunction · 0.85
schemaFunction · 0.70
concatFunction · 0.50
litFunction · 0.50
buildMethod · 0.45
with_schemaMethod · 0.45
eqMethod · 0.45
simplifyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…