From beddfda75e7e32ec43e87325b8a30491281dd307 Mon Sep 17 00:00:00 2001 From: obdev Date: Sat, 10 Feb 2024 06:05:27 +0000 Subject: [PATCH] Fix the correctness problem of vectorized merge distinct --- src/sql/engine/aggregate/ob_aggregate_processor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sql/engine/aggregate/ob_aggregate_processor.cpp b/src/sql/engine/aggregate/ob_aggregate_processor.cpp index e985821e6f..5d5c166097 100644 --- a/src/sql/engine/aggregate/ob_aggregate_processor.cpp +++ b/src/sql/engine/aggregate/ob_aggregate_processor.cpp @@ -1617,7 +1617,8 @@ int ObAggregateProcessor::process_distinct_batch( LOG_WARN("distinct set is NULL", K(ret)); } else { // In non-rollup group_id must be 0 - if (group_id > 0) { + if (group_id > 0 && group_id > start_partial_rollup_idx_ && + group_id <= end_partial_rollup_idx_) { // Group id greater than zero in sort based group by must be rollup, // distinct set is sorted and iterated in rollup_process(), rewind here. if (OB_FAIL(extra_info->unique_sort_op_->rewind())) {