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

[GitHub] [arrow-datafusion] viirya commented on a diff in pull request #6175: Handle ScalarValue::Dictionary in add_to_row and update_avg_to_row

viirya commented on code in PR #6175:
URL: https://github.com/apache/arrow-datafusion/pull/6175#discussion_r1181788955


##########
datafusion/physical-expr/src/aggregate/sum.rs:
##########
@@ -546,4 +555,76 @@ mod tests {
             Arc::new(Float64Array::from(vec![1_f64, 2_f64, 3_f64, 4_f64, 5_f64]));
         generic_test_op!(a, DataType::Float64, Sum, ScalarValue::from(15_f64))
     }
+
+    fn row_aggregate(
+        array: &ArrayRef,
+        agg: Arc<dyn AggregateExpr>,
+        row_accessor: &mut RowAccessor,
+    ) -> Result<ScalarValue> {
+        let mut accum = agg.create_row_accumulator(0)?;
+        let scalar_value = ScalarValue::try_from_array(array, 0)?;
+
+        accum.update_scalar(&scalar_value, row_accessor)?;
+        accum.evaluate(row_accessor)
+    }
+
+    #[test]
+    fn sum_dictionary_f64() -> Result<()> {
+        let keys = Int32Array::from(vec![0, 1, 2, 3, 4]);

Review Comment:
   Yea, improved the test coverage.



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