jonathanc-n commented on code in PR #20730:
URL: https://github.com/apache/datafusion/pull/20730#discussion_r2912887419
##########
datafusion/physical-optimizer/src/join_selection.rs:
##########
@@ -87,16 +87,18 @@ fn supports_collect_by_thresholds(
threshold_byte_size: usize,
threshold_num_rows: usize,
) -> bool {
- // Currently we do not trust the 0 value from stats, due to stats
collection might have bug
- // TODO check the logic in datasource::get_statistics_with_limit()
let Ok(stats) = plan.partition_statistics(None) else {
return false;
};
+ // Stats use `Precision<T>` to represent stats, where `Absent` means
unknown.
+ // `Exact(0)` and `Inexact(0)` are both valid stats, and we should not
treat
+ // them as unknown, `Absent` will return None (this is in regards to why
+ // `!=0` is not checked)
if let Some(byte_size) = stats.total_byte_size.get_value() {
- *byte_size != 0 && *byte_size < threshold_byte_size
Review Comment:
Byte size can be zero if working on empty table/partition or if filter exec
filters down to zero rows.
This PR just removes this check as it is not longer a problem due to the
addition of `Precision` (this check was added 2 years ago). This sanity check
was previously here because getting statistics with limit would unwrap to zero
(which would now be Absent)
--
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]