Dandandan commented on code in PR #17606:
URL: https://github.com/apache/datafusion/pull/17606#discussion_r2354418549


##########
datafusion/functions-aggregate/src/count.rs:
##########
@@ -746,12 +746,25 @@ fn null_count_for_multiple_cols(values: &[ArrayRef]) -> 
usize {
 /// more efficient such as [`PrimitiveDistinctCountAccumulator`] and
 /// [`BytesDistinctCountAccumulator`]
 #[derive(Debug)]
-struct DistinctCountAccumulator {
+pub struct DistinctCountAccumulator {
     values: HashSet<ScalarValue, RandomState>,

Review Comment:
   We don't need to track whether the values are distinct, we already know when 
all hashes are unique after building the map (number of hashes in the table 
equals number of rows). There is a method `is_unique` (or similar) that does 
the calculation.
   I suggest we calculate the min/max after loading the values in memory 
@jonathanc-n and only when all hashes have a single value.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to