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

Function basic

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

Source from the content-addressed store, hash-verified

154
155#[test]
156fn basic() {
157 let context = SimplifyContext::builder()
158 .with_schema(schema())
159 .with_query_execution_start_time(Some(Utc::now()))
160 .build();
161
162 // The `Expr` is a core concept in DataFusion, and DataFusion can
163 // help simplify it.
164
165 // For example 'a < (2 + 3)' can be rewritten into the easier to
166 // optimize form `a < 5` automatically
167 let expr = col("a").lt(lit(2i32) + lit(3i32));
168
169 let simplifier = ExprSimplifier::new(context);
170 let simplified = simplifier.simplify(expr).unwrap();
171 assert_eq!(simplified, col("a").lt(lit(5i32)));
172}
173
174#[test]
175fn fold_and_simplify() {

Callers 1

test_rankFunction · 0.85

Calls 9

newFunction · 0.85
schemaFunction · 0.70
colFunction · 0.50
litFunction · 0.50
buildMethod · 0.45
with_schemaMethod · 0.45
ltMethod · 0.45
simplifyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…