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

Function prune_cast_scalar

datafusion/pruning/src/pruning_predicate.rs:4365–4402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4363
4364 #[test]
4365 fn prune_cast_scalar() {
4366 // The data type of column i is INT32
4367 let (schema, statistics) = int32_setup();
4368 let expected_ret = &[true, true, false, true, true];
4369
4370 prune_with_expr(
4371 // i > int64(0)
4372 col("i").gt(cast(lit(ScalarValue::Int64(Some(0))), DataType::Int32)),
4373 &schema,
4374 &statistics,
4375 expected_ret,
4376 );
4377
4378 prune_with_expr(
4379 // cast(i as int64) > int64(0)
4380 cast(col("i"), DataType::Int64).gt(lit(ScalarValue::Int64(Some(0)))),
4381 &schema,
4382 &statistics,
4383 expected_ret,
4384 );
4385
4386 prune_with_expr(
4387 // try_cast(i as int64) > int64(0)
4388 try_cast(col("i"), DataType::Int64).gt(lit(ScalarValue::Int64(Some(0)))),
4389 &schema,
4390 &statistics,
4391 expected_ret,
4392 );
4393
4394 prune_with_expr(
4395 // `-cast(i as int64) < 0` convert to `cast(i as int64) > -0`
4396 Expr::Negative(Box::new(cast(col("i"), DataType::Int64)))
4397 .lt(lit(ScalarValue::Int64(Some(0)))),
4398 &schema,
4399 &statistics,
4400 expected_ret,
4401 );
4402 }
4403
4404 #[test]
4405 fn test_increment_utf8() {

Callers

nothing calls this directly

Calls 9

int32_setupFunction · 0.85
prune_with_exprFunction · 0.85
newFunction · 0.85
colFunction · 0.50
castFunction · 0.50
litFunction · 0.50
try_castFunction · 0.50
gtMethod · 0.45
ltMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…