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

[GitHub] [arrow-datafusion] allenma commented on a diff in pull request #5908: Count agg support multiple expressions

allenma commented on code in PR #5908:
URL: https://github.com/apache/arrow-datafusion/pull/5908#discussion_r1161051932


##########
datafusion/physical-expr/src/aggregate/count.rs:
##########
@@ -53,11 +55,43 @@ impl Count {
     ) -> Self {
         Self {
             name: name.into(),
-            expr,
+            exprs: vec![expr],
             data_type,
             nullable: true,
         }
     }
+
+    pub fn new_with_multiple_exprs(
+        exprs: Vec<Arc<dyn PhysicalExpr>>,
+        name: impl Into<String>,
+        data_type: DataType,
+    ) -> Self {
+        Self {
+            name: name.into(),
+            exprs,
+            data_type,
+            nullable: true,
+        }
+    }
+}
+
+/// count null values for multiple columns
+/// for each row if one column value is null, then null_count + 1
+fn null_count_for_multiple_cols(values: &[ArrayRef]) -> usize {

Review Comment:
   Thanks, we can refactor it in the future if we find a better way



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