HappenLee commented on code in PR #49212: URL: https://github.com/apache/doris/pull/49212#discussion_r2004750242
########## be/src/vec/exprs/lambda_function/varray_map_function.cpp: ########## @@ -184,57 +184,73 @@ class ArrayMapFunction : public LambdaFunction { data_types.push_back(col_type.get_nested_type()); } - ColumnPtr result_col = nullptr; + MutableColumnPtr result_col = nullptr; DataTypePtr res_type; std::string res_name; //process first row - args.array_start = (*args.offsets_ptr)[args.current_row_idx - 1]; - args.cur_size = (*args.offsets_ptr)[args.current_row_idx] - args.array_start; - - while (args.current_row_idx < block->rows()) { - Block lambda_block; - for (int i = 0; i < names.size(); i++) { - ColumnWithTypeAndName data_column; - if (_contains_column_id(args, i) || i >= gap) { - data_column = ColumnWithTypeAndName(data_types[i], names[i]); + args_info.array_start = (*args_info.offsets_ptr)[args_info.current_row_idx - 1]; + args_info.cur_size = + (*args_info.offsets_ptr)[args_info.current_row_idx] - args_info.array_start; + + // lambda block to exectute the lambda, and reuse the memory + Block lambda_block; + auto column_size = names.size(); + MutableColumns columns(column_size); + while (args_info.current_row_idx < block->rows()) { + bool mem_reuse = lambda_block.mem_reuse(); + for (int i = 0; i < column_size; i++) { + if (mem_reuse) { Review Comment: if mem_reuse ? columns seem already contain the right column. why need do the op: ``` columns[i] = lambda_block.get_by_position(i).column->assume_mutable(); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org