Dandandan commented on code in PR #11627:
URL: https://github.com/apache/datafusion/pull/11627#discussion_r1694799488
##########
datafusion/physical-expr-common/src/aggregate/groups_accumulator/prim_op.rs:
##########
@@ -134,6 +134,46 @@ where
self.update_batch(values, group_indices, opt_filter, total_num_groups)
}
+ fn convert_to_state(
+ &self,
+ values: &[ArrayRef],
+ opt_filter: Option<&BooleanArray>,
+ ) -> Result<Vec<ArrayRef>> {
+ let values = values[0].as_primitive::<T>();
+ let mut state = PrimitiveBuilder::<T>::with_capacity(values.len())
+ .with_data_type(self.data_type.clone());
+
+ match opt_filter {
+ Some(filter) => {
+ values
Review Comment:
I see, we can't use filter here as we need to produce the values as is.
I think we should be able to build the values based on the values buffer and
handle nulls separately:
* no filter: just pass null mask of `values`
* filter present: `bitwise_and` both null masks
this should also be beneficial for the non-null case, as it avoids the
iterator/builder
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]