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

Function evaluate_bounds_and

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

Source from the content-addressed store, hash-verified

278
279 #[test]
280 fn evaluate_bounds_and() {
281 let null = lit(ScalarValue::Null);
282 let zero = lit(0);
283 let one = lit(1);
284 let t = lit(true);
285 let f = lit(false);
286 let func = make_scalar_func_expr();
287
288 #[rustfmt::skip]
289 let cases = vec![
290 (binary_expr(null.clone(), And, null.clone()), NullableInterval::UNKNOWN),
291 (binary_expr(null.clone(), And, one.clone()), NullableInterval::UNKNOWN),
292 (binary_expr(null.clone(), And, zero.clone()), NullableInterval::FALSE),
293 (binary_expr(one.clone(), And, one.clone()), NullableInterval::TRUE),
294 (binary_expr(one.clone(), And, zero.clone()), NullableInterval::FALSE),
295 (binary_expr(null.clone(), And, t.clone()), NullableInterval::UNKNOWN),
296 (binary_expr(t.clone(), And, null.clone()), NullableInterval::UNKNOWN),
297 (binary_expr(null.clone(), And, f.clone()), NullableInterval::FALSE),
298 (binary_expr(f.clone(), And, null.clone()), NullableInterval::FALSE),
299 (binary_expr(t.clone(), And, t.clone()), NullableInterval::TRUE),
300 (binary_expr(t.clone(), And, f.clone()), NullableInterval::FALSE),
301 (binary_expr(f.clone(), And, t.clone()), NullableInterval::FALSE),
302 (binary_expr(f.clone(), And, f.clone()), NullableInterval::FALSE),
303 (binary_expr(t.clone(), And, func.clone()), NullableInterval::ANY_TRUTH_VALUE),
304 (binary_expr(func.clone(), And, t.clone()), NullableInterval::ANY_TRUTH_VALUE),
305 (binary_expr(f.clone(), And, func.clone()), NullableInterval::FALSE),
306 (binary_expr(func.clone(), And, f.clone()), NullableInterval::FALSE),
307 (binary_expr(null.clone(), And, func.clone()), NullableInterval::FALSE_OR_UNKNOWN),
308 (binary_expr(func.clone(), And, null.clone()), NullableInterval::FALSE_OR_UNKNOWN),
309 ];
310
311 for case in cases {
312 assert_eq!(
313 eval_bounds(&case.0).unwrap(),
314 case.1,
315 "Failed for {}",
316 case.0
317 );
318 }
319 }
320
321 #[test]
322 fn evaluate_bounds_or() {

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…