appletreeisyellow commented on code in PR #9223:
URL: https://github.com/apache/arrow-datafusion/pull/9223#discussion_r1525628161
##########
datafusion/core/src/physical_optimizer/pruning.rs:
##########
@@ -2819,14 +3171,77 @@ mod tests {
let expected_ret = &[false, true, true, true, false];
prune_with_expr(
- // i IS NULL, with actual null statistcs
+ // i IS NULL, with actual null statistics
col("i").is_null(),
&schema,
&statistics,
expected_ret,
);
}
+ #[test]
+ fn prune_int32_column_is_known_all_null() {
+ let (schema, statistics) = int32_setup();
+
+ // Expression "i < 0"
+ // i [-5, 5] ==> some rows could pass (must keep)
+ // i [1, 11] ==> no rows can pass (not keep)
+ // i [-11, -1] ==> all rows must pass (must keep)
+ // i [NULL, NULL] ==> unknown (must keep)
+ // i [1, NULL] ==> no rows can pass (not keep)
+ let expected_ret = &[true, false, true, true, false];
+
+ prune_with_expr(
+ // i < 0
+ col("i").lt(lit(0)),
+ &schema,
+ &statistics,
+ expected_ret,
+ );
+
+ // provide row counts for each column
+ let statistics = statistics.with_row_counts(
+ "i",
+ vec![
+ Some(10), // 10 rows of data
+ Some(9), // 9 rows of data
+ None, // unknown row counts
+ Some(4),
+ Some(10),
+ ],
+ );
+
Review Comment:
Added in
https://github.com/apache/arrow-datafusion/pull/9223/commits/a385bffe572653a37868fcca7f464e1b3b6cb5ff
--
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]