Skip to content

Commit c620d30

Browse files
committed
add more testcase
1 parent e8914c0 commit c620d30

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

datafusion/physical-optimizer/src/pruning.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ fn build_like_match(
17111711
Some(combined)
17121712
}
17131713

1714-
// For predicate `col NOT LIKE 'const_prefix%'`, we rewrite it as `(col_min NOT LIKE 'const_prefix%' OR col_max NOT LIKE 'const_prefix%')`.
1714+
// For predicate `col NOT LIKE 'const_prefix%'`, we rewrite it as `(col_min NOT LIKE 'const_prefix%' OR col_max NOT LIKE 'const_prefix%')`.
17151715
//
17161716
// The intuition is that if both `col_min` and `col_max` begin with `const_prefix` that means
17171717
// **all** data in this row group begins with `const_prefix` as well (and therefore the predicate
@@ -4224,6 +4224,32 @@ mod tests {
42244224
];
42254225
prune_with_expr(expr, &schema, &statistics, expected_ret);
42264226

4227+
let expr = col("s1").not_like(lit("A\u{10ffff}%\u{10ffff}_"));
4228+
#[rustfmt::skip]
4229+
let expected_ret = &[
4230+
// s1 ["A", "Z"] ==> some rows could pass (must keep)
4231+
true,
4232+
// s1 ["A", "L"] ==> some rows could pass (must keep)
4233+
true,
4234+
// s1 ["N", "Z"] ==> some rows could pass (must keep)
4235+
true,
4236+
// s1 ["M", "M"] ==> some rows could pass (must keep)
4237+
true,
4238+
// s1 [NULL, NULL] ==> unknown (must keep)
4239+
true,
4240+
// s1 ["A", NULL] ==> some rows could pass (must keep)
4241+
true,
4242+
// s1 ["", "A"] ==> some rows could pass (must keep)
4243+
true,
4244+
// s1 ["", ""] ==> some rows could pass (must keep)
4245+
true,
4246+
// s1 ["AB", "A\u{10ffff}\u{10ffff}\u{10ffff}"] ==> some rows could pass (must keep)
4247+
true,
4248+
// s1 ["A\u{10ffff}\u{10ffff}", "A\u{10ffff}\u{10ffff}"] ==> some rows could pass (must keep)
4249+
true,
4250+
];
4251+
prune_with_expr(expr, &schema, &statistics, expected_ret);
4252+
42274253
let expr = col("s1").not_like(lit("A\\%%"));
42284254
let statistics = TestStatistics::new().with(
42294255
"s1",

0 commit comments

Comments
 (0)