adriangb commented on code in PR #12978:
URL: https://github.com/apache/datafusion/pull/12978#discussion_r1805519630


##########
datafusion/core/src/physical_optimizer/pruning.rs:
##########
@@ -3443,6 +3545,115 @@ mod tests {
         );
     }
 
+    /// Creates a setup for chunk pruning, modeling a utf8 column "s1"
+    /// with 5 different containers (e.g. RowGroups). They have [min,
+    /// max]:
+    /// s1 ["A", "Z"]
+    /// s1 ["A", "L"]
+    /// s1 ["N", "Z"]
+    /// s1 [NULL, NULL]
+    /// s1 ["A", NULL]
+    fn utf8_setup() -> (SchemaRef, TestStatistics) {
+        let schema = Arc::new(Schema::new(vec![Field::new("s1", 
DataType::Utf8, true)]));
+
+        let statistics = TestStatistics::new().with(
+            "s1",
+            ContainerStats::new_utf8(
+                vec![Some("A"), Some("A"), Some("N"), Some("M"), None, 
Some("A")], // min
+                vec![Some("Z"), Some("L"), Some("Z"), Some("M"), None, None],  
    // max
+            ),
+        );
+        (schema, statistics)
+    }
+
+    #[test]
+    fn prune_utf8_eq() {
+        let (schema, statistics) = utf8_setup();
+
+        // Expression "s1 = 'A'"
+        // s1 ["A", "Z"] ==> some rows could pass (must keep)
+        // s1 ["A", "L"] ==> some rows could pass (must keep)
+        // s1 ["N", "Z"] ==> no rows can pass (not keep)
+        // s1 ["M", "M"] ==> no rows can pass (not keep)
+        // s1 [NULL, NULL]  ==> unknown (must keep)
+        // s1 ["A", NULL]  ==> unknown (must keep)
+        let expected_ret = &[true, true, false, false, true, true];
+
+        prune_with_expr(
+            // s1 LIKE 'A%'

Review Comment:
   Okay I've tried to get all of these comments right, I think they can be 
removed tbh the expression is pretty self explanatory, but left them for now, 
let me know if you'd prefer that I remove them or if you want to keep them if 
there are any obviously wrong



-- 
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]

Reply via email to