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

Function evaluate_bounds_or

datafusion/expr/src/predicate_bounds.rs:322–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320
321 #[test]
322 fn evaluate_bounds_or() {
323 let null = lit(ScalarValue::Null);
324 let zero = lit(0);
325 let one = lit(1);
326 let t = lit(true);
327 let f = lit(false);
328 let func = make_scalar_func_expr();
329
330 #[rustfmt::skip]
331 let cases = vec![
332 (binary_expr(null.clone(), Or, null.clone()), NullableInterval::UNKNOWN),
333 (binary_expr(null.clone(), Or, one.clone()), NullableInterval::TRUE),
334 (binary_expr(null.clone(), Or, zero.clone()), NullableInterval::UNKNOWN),
335 (binary_expr(one.clone(), Or, one.clone()), NullableInterval::TRUE),
336 (binary_expr(one.clone(), Or, zero.clone()), NullableInterval::TRUE),
337 (binary_expr(null.clone(), Or, t.clone()), NullableInterval::TRUE),
338 (binary_expr(t.clone(), Or, null.clone()), NullableInterval::TRUE),
339 (binary_expr(null.clone(), Or, f.clone()), NullableInterval::UNKNOWN),
340 (binary_expr(f.clone(), Or, null.clone()), NullableInterval::UNKNOWN),
341 (binary_expr(t.clone(), Or, t.clone()), NullableInterval::TRUE),
342 (binary_expr(t.clone(), Or, f.clone()), NullableInterval::TRUE),
343 (binary_expr(f.clone(), Or, t.clone()), NullableInterval::TRUE),
344 (binary_expr(f.clone(), Or, f.clone()), NullableInterval::FALSE),
345 (binary_expr(t.clone(), Or, func.clone()), NullableInterval::TRUE),
346 (binary_expr(func.clone(), Or, t.clone()), NullableInterval::TRUE),
347 (binary_expr(f.clone(), Or, func.clone()), NullableInterval::ANY_TRUTH_VALUE),
348 (binary_expr(func.clone(), Or, f.clone()), NullableInterval::ANY_TRUTH_VALUE),
349 (binary_expr(null.clone(), Or, func.clone()), NullableInterval::TRUE_OR_UNKNOWN),
350 (binary_expr(func.clone(), Or, null.clone()), NullableInterval::TRUE_OR_UNKNOWN),
351 ];
352
353 for case in cases {
354 assert_eq!(
355 eval_bounds(&case.0).unwrap(),
356 case.1,
357 "Failed for {}",
358 case.0
359 );
360 }
361 }
362
363 #[test]
364 fn evaluate_bounds_not() {

Callers

nothing calls this directly

Calls 2

make_scalar_func_exprFunction · 0.85
litFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…