jayzhan211 commented on code in PR #7242:
URL: https://github.com/apache/arrow-datafusion/pull/7242#discussion_r1292885778
##########
datafusion/physical-expr/src/aggregate/sum.rs:
##########
@@ -291,6 +309,27 @@ pub(crate) fn sum_batch(values: &ArrayRef, sum_type:
&DataType) -> Result<Scalar
DataType::UInt32 => typed_sum_delta_batch!(values, UInt32Array,
UInt32),
DataType::UInt16 => typed_sum_delta_batch!(values, UInt16Array,
UInt16),
DataType::UInt8 => typed_sum_delta_batch!(values, UInt8Array, UInt8),
+ DataType::List(field) => {
+ let array = values.as_list::<i32>();
+ let mut scalars: Vec<ScalarValue> = vec![];
+ for arr in array.iter() {
+ if let Some(arr) = arr {
+ let sum = sum_batch(&arr, field.data_type())?;
+ match sum {
+ ColumnarValue::Scalar(sv) => {
+ scalars.push(sv);
+ }
+ e => {
+ return Err(DataFusionError::Internal(format!(
+ "Sum is not expected to receive the type {e:?}"
+ )));
+ }
+ }
+ }
+ }
+ let arr = ScalarValue::iter_to_array(scalars.into_iter())?;
Review Comment:
This is where I construct Array.
--
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]