From 4cad4cdee6ae6294afc955ea0953778d46dcfab7 Mon Sep 17 00:00:00 2001 From: Zach41 Date: Tue, 23 Jul 2024 10:11:10 +0000 Subject: [PATCH] Fix incorrect result of window function with comlicated partition exprs --- .../engine/window_function/ob_window_function_vec_op.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sql/engine/window_function/ob_window_function_vec_op.cpp b/src/sql/engine/window_function/ob_window_function_vec_op.cpp index 18c8385ed..69bd2d1ec 100644 --- a/src/sql/engine/window_function/ob_window_function_vec_op.cpp +++ b/src/sql/engine/window_function/ob_window_function_vec_op.cpp @@ -1263,6 +1263,9 @@ int ObWindowFunctionVecOp::eval_prev_part_exprs(const ObCompactRow *last_row, Ob if (OB_FAIL(ret)) { } else if (backuped_child_vector && OB_FAIL(tmp_holder.restore())) { LOG_WARN("restore vector results failed", K(ret)); + } else if (backuped_child_vector) { + // clear evaluated flags anyway + clear_evaluated_flag(); } return ret; } @@ -1625,7 +1628,7 @@ int ObWindowFunctionVecOp::process_child_batch(const int64_t batch_idx, LOG_WARN("add aggregate result row for participator failed", K(ret)); } else { LOG_TRACE("found new partition", K(found_next_part), K(part_start_idx), K(row_idx), - K(child_brs), K(need_swap_store)); + K(*child_brs), K(need_swap_store)); } } if (OB_FAIL(ret)) { @@ -1772,7 +1775,7 @@ int ObWindowFunctionVecOp::check_same_partition(WinFuncColExpr &wf_col, bool &sa int64_t row_idx = eval_ctx_.get_batch_idx(); int32_t offset = max_pby_col_cnt_ * row_idx; int32_t *pby_row_idxes = &(pby_row_mapped_idx_arr_[offset]); - if (OB_UNLIKELY(wf_col.reordered_pby_row_idx_ == nullptr)) { + if (OB_LIKELY(wf_col.reordered_pby_row_idx_ == nullptr)) { same = (MEMCMP(pby_row_idxes, wf_col.pby_row_mapped_idxes_, sizeof(int32_t) * part_cnt) == 0); } else { same = true;