From 5f57aa9e58342cb7514dbd8f8e408845cd8ba7cc Mon Sep 17 00:00:00 2001 From: lz0 Date: Tue, 23 Nov 2021 13:51:38 +0800 Subject: [PATCH] Fix rollup wrong result bug --- src/sql/engine/aggregate/ob_merge_groupby_op.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sql/engine/aggregate/ob_merge_groupby_op.cpp b/src/sql/engine/aggregate/ob_merge_groupby_op.cpp index a3d9900ac1..0670069469 100644 --- a/src/sql/engine/aggregate/ob_merge_groupby_op.cpp +++ b/src/sql/engine/aggregate/ob_merge_groupby_op.cpp @@ -157,6 +157,9 @@ int ObMergeGroupByOp::rewrite_rollup_column(ObExpr*& diff_expr) diff_expr = NULL; } } + if (is_distinct_expr) { + diff_expr = nullptr; + } } return ret; } @@ -418,7 +421,6 @@ int ObMergeGroupByOp::rollup_and_calc_results(const int64_t group_id, const ObEx if (OB_FAIL(aggr_processor_.rollup_process(group_id, diff_expr))) { LOG_WARN("failed to rollup aggregation results", K(ret)); } - diff_expr = 0; } if (OB_SUCC(ret)) { clear_evaluated_flag(); -- GitLab