alamb commented on code in PR #5377:
URL: https://github.com/apache/arrow-datafusion/pull/5377#discussion_r1117941665


##########
datafusion/physical-expr/src/aggregate/count_distinct.rs:
##########
@@ -216,23 +216,19 @@ impl Accumulator for DistinctCountAccumulator {
     }
 
     fn size(&self) -> usize {
+        // temporarily calculating the size approximately, taking first batch 
size * number of batches
+        // such approach has some inaccuracy for variable length values, like 
strings.

Review Comment:
   > are we missing this conditionall check in this PR? so we still have 
accurate size (slow for now) for variable data and accurate size (fast) for 
fixed lenth data
   
   This is the middle path I would suggest: keep the slow but accurate 
accounting for variable length data (aka strings) and add a fast path for fixed 
length sizes (what is in the benchmark)
   
   I believe the the additional overhead of doing accurate size accounting for 
string values is a relatively smaller amount of the overall time compared to 
fixed size types. Making `count distinct` with a large number of string values 
fast is likely going to take a more sophisticated approach to this query in 
general.



-- 
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]

Reply via email to