Copilot commented on code in PR #27627:
URL: https://github.com/apache/datafusion/pull/27627#discussion_r4650161548
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -1742,8 +1762,15 @@ fn null_check_statistics(
})
};
stats.total_byte_size = scale_bytes(stats.total_byte_size);
- for column_stats in &mut stats.column_statistics {
- column_stats.null_count = cap_at_rows(column_stats.null_count,
num_rows);
+ for (column_stats, input_null_count) in
+ stats.column_statistics.iter_mut().zip(input_null_counts)
+ {
+ column_stats.null_count = selectivity.map_or_else(
+ || cap_at_rows(input_null_count, num_rows),
Review Comment:
When the input row count is `Absent`, `a IS NULL` can still produce a
positive row estimate from `a.null_count`, but `selectivity` is `None`. An
unrelated column with `null_count = Exact(0)` then goes through `cap_at_rows`
here and becomes `Inexact(0)`, bypassing the new helper's exact-zero
preservation. Please preserve `Exact(0)` in this fallback too, and add a case
with unknown input rows and a zero-null unrelated column.
--
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]