xudong963 commented on code in PR #19957:
URL: https://github.com/apache/datafusion/pull/19957#discussion_r2910711598
##########
datafusion/common/src/stats.rs:
##########
@@ -660,7 +637,14 @@ impl Statistics {
col_stats.max_value =
col_stats.max_value.max(&item_col_stats.max_value);
col_stats.min_value =
col_stats.min_value.min(&item_col_stats.min_value);
col_stats.sum_value =
col_stats.sum_value.add(&item_col_stats.sum_value);
- col_stats.distinct_count = Precision::Absent;
+ // Use max as a conservative lower bound for distinct count
+ // (can't accurately merge NDV since duplicates may exist across
partitions)
Review Comment:
I'm concerned that the conservative lower-bound estimation could cause huge
inaccuracy.
For example, we have 100 parts, and each part has 100 rows, and they are
linearly increasing. The reality is that the ndv should be 100 * 100, but now
we evaluate it as 100. The result could cause inaccuracies to propagate
throughout subsequent cost estimation algorithms.
--
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]