ranflarion commented on code in PR #24736:
URL: https://github.com/apache/datafusion/pull/24736#discussion_r3891745467
##########
datafusion/physical-plan/src/aggregates/group_values/metrics.rs:
##########
@@ -475,6 +475,81 @@ mod tests {
Ok(())
}
+ #[tokio::test]
+ async fn test_groupby_aggregation_time_not_inflated_by_accumulator_count()
+ -> Result<()> {
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("k", DataType::UInt32, false),
+ Field::new("v", DataType::Float64, false),
+ ]));
+
+ const ROWS: usize = 8192;
+ let batches = (0..20)
+ .map(|_| {
+ RecordBatch::try_new(
+ Arc::clone(&schema),
+ vec![
+ Arc::new(UInt32Array::from(
+ (0..ROWS).map(|r| (r % 8) as
u32).collect::<Vec<_>>(),
+ )),
+ Arc::new(Float64Array::from(
+ (0..ROWS).map(|r| r as f64).collect::<Vec<_>>(),
+ )),
+ ],
+ )
+ .unwrap()
+ })
+ .collect::<Vec<_>>();
+
+ let input = TestMemoryExec::try_new_exec(&[batches],
Arc::clone(&schema), None)?;
+ let group_by =
+ PhysicalGroupBy::new_single(vec![(col("k", &schema)?,
"k".to_string())]);
+
+ let aggregates = (0..8)
+ .map(|i| sum_aggregate(&schema, "v", &format!("SUM{i}(v)")))
+ .collect::<Result<Vec<_>>>()?;
+ let filters = vec![None; aggregates.len()];
+
+ let aggregate_exec = Arc::new(AggregateExec::try_new(
+ AggregateMode::Partial,
+ group_by,
+ aggregates,
+ filters,
+ input,
+ schema,
+ )?);
+
+ let runtime = RuntimeEnvBuilder::new()
+ .with_memory_limit(64 * 1024 * 1024, 1.0)
Review Comment:
yes
--
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]