From 76f5aba9580e16ef6b946deb8adbe0bc63ac49d0 Mon Sep 17 00:00:00 2001 From: kamille Date: Tue, 6 Aug 2024 14:29:33 +0800 Subject: [PATCH] tmp --- .../src/aggregate/groups_accumulator.rs | 4 +--- .../test_files/aggregate_skip_partial.slt | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs b/datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs index cdb917bb9a41b..b48eeb96580e4 100644 --- a/datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs +++ b/datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs @@ -132,9 +132,7 @@ impl GroupsAccumulatorAdapter { let new_accumulators = input_batch_size - self.convert_state_buffer.len(); for _ in 0..new_accumulators { let accumulator = (self.factory)()?; - let state = AccumulatorState::new(accumulator); - self.add_allocation(state.size()); - self.states.push(state); + self.convert_state_buffer.push(accumulator); } self.adjust_allocation( diff --git a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt index 6c0cf5f800d89..26cf4131c4068 100644 --- a/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt +++ b/datafusion/sqllogictest/test_files/aggregate_skip_partial.slt @@ -117,6 +117,17 @@ GROUP BY 1, 2 ORDER BY 1 LIMIT 5; -2117946883 d -2117946883 NULL NULL NULL -2098805236 c -2098805236 NULL NULL NULL +query I +SELECT MEDIAN(c5) +FROM aggregate_test_100 +GROUP BY c1 ORDER BY c1 LIMIT 5; +---- +623103518 +41423756 +-382483011 +16122795 +427197269 + # Prepare settings to always skip aggregation after couple of batches statement ok set datafusion.execution.skip_partial_aggregation_probe_rows_threshold = 10;