You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Dandandan (via GitHub)" <gi...@apache.org> on 2023/02/25 16:28:28 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #5377: Optimize count_distinct.size

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


##########
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:
   The overhead for an accurate answer is still enormous for variable length types and gets worse with increasing table sizes, as the `size` gets slower with more distinct values in the aggregation, and is called for every update (so a `O(n^2)` operation).



-- 
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-unsubscribe@arrow.apache.org

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