thinkharderdev commented on code in PR #22375:
URL: https://github.com/apache/datafusion/pull/22375#discussion_r3268869446
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -4816,6 +4820,35 @@ mod tests {
prune_with_expr(expr, &schema, &statistics, expected_ret);
}
+ // `build_like_match()` must honor `\` escapes when scanning the pattern
for
+ // wildcards.
+ #[test]
+ fn prune_utf8_like_escaped_underscore() {
+ let schema = Arc::new(Schema::new(vec![Field::new("s1",
DataType::Utf8, true)]));
+ let statistics = TestStatistics::new().with(
+ "s1",
+ ContainerStats::new_utf8(
+ vec![Some("foo_aaa"), Some("bar"), Some("foo")], // min
+ vec![Some("foo_zzz"), Some("baz"), Some("foozzz")], // max
+ ),
+ );
+
+ let expr = col("s1").like(lit("foo\\_%"));
Review Comment:
nit: I usually like to use raw strings `r#"foo\_"#` to make these examples
less confusing
Can we add a test case with double-escape (e.g. `r#"foo\\_"#`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]