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

Function test_const_evaluator

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

Source from the content-addressed store, hash-verified

322
323#[test]
324fn test_const_evaluator() {
325 // true --> true
326 test_evaluate(lit(true), lit(true));
327 // true or true --> true
328 test_evaluate(lit(true).or(lit(true)), lit(true));
329 // true or false --> true
330 test_evaluate(lit(true).or(lit(false)), lit(true));
331
332 // "foo" == "foo" --> true
333 test_evaluate(lit("foo").eq(lit("foo")), lit(true));
334 // "foo" != "foo" --> false
335 test_evaluate(lit("foo").not_eq(lit("foo")), lit(false));
336
337 // c = 1 --> c = 1
338 test_evaluate(col("c").eq(lit(1)), col("c").eq(lit(1)));
339 // c = 1 + 2 --> c + 3
340 test_evaluate(col("c").eq(lit(1) + lit(2)), col("c").eq(lit(3)));
341 // (foo != foo) OR (c = 1) --> false OR (c = 1)
342 test_evaluate(
343 (lit("foo").not_eq(lit("foo"))).or(col("c").eq(lit(1))),
344 col("c").eq(lit(1)),
345 );
346}
347
348#[test]
349fn test_const_evaluator_alias() {

Callers

nothing calls this directly

Calls 6

test_evaluateFunction · 0.85
not_eqMethod · 0.80
litFunction · 0.50
colFunction · 0.50
orMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…