From ee085bf40297b0c30bd97f91f2bd2faab3228cb7 Mon Sep 17 00:00:00 2001 From: eyes_on_me Date: Wed, 6 Nov 2024 18:58:00 +0800 Subject: [PATCH] [BugFix] remove unnecessary replicate for outer_common_expr (#52649) Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com> --- be/src/exprs/array_map_expr.cpp | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/be/src/exprs/array_map_expr.cpp b/be/src/exprs/array_map_expr.cpp index fa905b97951d3..a11ef5c5d14cf 100644 --- a/be/src/exprs/array_map_expr.cpp +++ b/be/src/exprs/array_map_expr.cpp @@ -139,28 +139,8 @@ StatusOr ArrayMapExpr::evaluate_lambda_expr(ExprContext* context, Chu } DCHECK(aligned_offsets != nullptr); - // 4. prepare outer common exprs - for (const auto& [slot_id, expr] : _outer_common_exprs) { - auto column = chunk->get_column_by_slot_id(slot_id); - column = ColumnHelper::unpack_and_duplicate_const_column(column->size(), column); - if constexpr (independent_lambda_expr) { - // if lambda expr doesn't rely on arguments, we don't need to align offset - cur_chunk->append_column(column, slot_id); - } else { - if (column->is_array()) { - auto view_column = ArrayViewColumn::from_array_column(column); - cur_chunk->append_column(view_column->replicate(aligned_offsets->get_data()), slot_id); - } else { - cur_chunk->append_column(column->replicate(aligned_offsets->get_data()), slot_id); - } - } - } - - // 5. prepare capture columns + // 4. prepare capture columns for (auto slot_id : capture_slot_ids) { - if (cur_chunk->is_slot_exist(slot_id)) { - continue; - } auto captured_column = chunk->get_column_by_slot_id(slot_id); if constexpr (independent_lambda_expr) { cur_chunk->append_column(captured_column, slot_id); @@ -174,7 +154,7 @@ StatusOr ArrayMapExpr::evaluate_lambda_expr(ExprContext* context, Chu } } - // 6. evaluate lambda expr + // 5. evaluate lambda expr ColumnPtr column = nullptr; if constexpr (independent_lambda_expr) { // if lambda expr doesn't rely on arguments, we evaluate it first, and then align offsets