From c54b6ee86efee3b42066afc480584acd9bee536e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:54:17 +0800 Subject: [PATCH] [BugFix] Fix chunk accumulator miss assign _max_size (backport #52579) (#52596) Signed-off-by: stdpain <34912776+stdpain@users.noreply.github.com> Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com> --- .../aggregate/spillable_aggregate_blocking_source_operator.cpp | 1 + .../spillable_aggregate_distinct_blocking_operator.cpp | 1 + be/src/exec/pipeline/hash_partition_context.cpp | 1 + test/sql/test_spill/R/test_spill_aggregate | 2 +- test/sql/test_spill/T/test_spill_aggregate | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_source_operator.cpp b/be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_source_operator.cpp index 3999c2cc69fe6..cfa27a6a6b1e4 100644 --- a/be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_source_operator.cpp +++ b/be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_source_operator.cpp @@ -24,6 +24,7 @@ Status SpillableAggregateBlockingSourceOperator::prepare(RuntimeState* state) { RETURN_IF_ERROR(AggregateBlockingSourceOperator::prepare(state)); RETURN_IF_ERROR(_stream_aggregator->prepare(state, state->obj_pool(), _unique_metrics.get())); RETURN_IF_ERROR(_stream_aggregator->open(state)); + _accumulator.set_max_size(state->chunk_size()); return Status::OK(); } diff --git a/be/src/exec/pipeline/aggregate/spillable_aggregate_distinct_blocking_operator.cpp b/be/src/exec/pipeline/aggregate/spillable_aggregate_distinct_blocking_operator.cpp index 755eb14736284..a791c53abe1c2 100644 --- a/be/src/exec/pipeline/aggregate/spillable_aggregate_distinct_blocking_operator.cpp +++ b/be/src/exec/pipeline/aggregate/spillable_aggregate_distinct_blocking_operator.cpp @@ -170,6 +170,7 @@ Status SpillableAggregateDistinctBlockingSourceOperator::prepare(RuntimeState* s RETURN_IF_ERROR(AggregateDistinctBlockingSourceOperator::prepare(state)); RETURN_IF_ERROR(_stream_aggregator->prepare(state, state->obj_pool(), _unique_metrics.get())); RETURN_IF_ERROR(_stream_aggregator->open(state)); + _accumulator.set_max_size(state->chunk_size()); return Status::OK(); } diff --git a/be/src/exec/pipeline/hash_partition_context.cpp b/be/src/exec/pipeline/hash_partition_context.cpp index 804a2d5390586..15483347aaf64 100644 --- a/be/src/exec/pipeline/hash_partition_context.cpp +++ b/be/src/exec/pipeline/hash_partition_context.cpp @@ -37,6 +37,7 @@ Status HashPartitionContext::prepare(RuntimeState* state, RuntimeProfile* profil _has_nullable_key = _has_nullable_key || _partition_types[i].is_nullable; } + _acc.set_max_size(state->chunk_size()); _chunks_partitioner = std::make_unique(_has_nullable_key, _partition_exprs, _partition_types); return _chunks_partitioner->prepare(state, profile); } diff --git a/test/sql/test_spill/R/test_spill_aggregate b/test/sql/test_spill/R/test_spill_aggregate index 432dd00d3a022..acd9f656f50e8 100644 --- a/test/sql/test_spill/R/test_spill_aggregate +++ b/test/sql/test_spill/R/test_spill_aggregate @@ -28,4 +28,4 @@ insert into t2 select sum(k1),k2 from t1 group by k2; select * from t2; -- result: 1 1 --- !result \ No newline at end of file +-- !result diff --git a/test/sql/test_spill/T/test_spill_aggregate b/test/sql/test_spill/T/test_spill_aggregate index 9bed02d79caa2..09813e0a18bbf 100644 --- a/test/sql/test_spill/T/test_spill_aggregate +++ b/test/sql/test_spill/T/test_spill_aggregate @@ -15,4 +15,4 @@ DUPLICATE KEY(k1) DISTRIBUTED BY HASH(k1) PROPERTIES('replication_num'='1'); insert into t1 values (1,"1"); insert into t2 select sum(k1),k2 from t1 group by k2; -select * from t2; \ No newline at end of file +select * from t2;