You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Weijun-H (via GitHub)" <gi...@apache.org> on 2023/02/27 10:33:54 UTC

[GitHub] [arrow-datafusion] Weijun-H commented on a diff in pull request #5408: refactor count_distinct to not to have update and merge

Weijun-H commented on code in PR #5408:
URL: https://github.com/apache/arrow-datafusion/pull/5408#discussion_r1118558056


##########
datafusion/physical-expr/src/aggregate/count_distinct.rs:
##########
@@ -205,6 +146,52 @@ impl Accumulator for DistinctCountAccumulator {
 
         Ok(cols_out.into_iter().collect())
     }
+    fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
+        if values.is_empty() {
+            return Ok(());
+        }
+        let arr = &values[0];
+        (0..arr.len()).try_for_each(|index| {
+            let scalar = ScalarValue::try_from_array(arr, index)?;
+            let scalar = vec![scalar];

Review Comment:
   Hello @Dandandan, thank you for reviewing my work. I'm currently having difficulty finding a way to avoid using `vec` in this context. Could you please provide me with some guidance on how to refactor it?



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