This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.2 by this push:
     new b56fa9727d0 branch-4.2: [opt](be) Avoid redundant column copies in 
functions and writers #70606 (#70713)
b56fa9727d0 is described below

commit b56fa9727d0ec3c9744a7fffcf9fc4d00bdb7619
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Dec 2 11:06:35 2026 +0800

    branch-4.2: [opt](be) Avoid redundant column copies in functions and 
writers #70606 (#70713)
    
    Cherry-picked from #70606
    
    Co-authored-by: Mryange <[email protected]>
---
 be/src/exec/sink/writer/vhive_table_writer.cpp      |  4 ++--
 be/src/exprs/function/comparison_equal_for_null.cpp |  4 ++--
 be/src/format/transformer/vorc_transformer.cpp      | 12 ++++--------
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/be/src/exec/sink/writer/vhive_table_writer.cpp 
b/be/src/exec/sink/writer/vhive_table_writer.cpp
index 453b00515e3..7ae17904a48 100644
--- a/be/src/exec/sink/writer/vhive_table_writer.cpp
+++ b/be/src/exec/sink/writer/vhive_table_writer.cpp
@@ -226,8 +226,8 @@ Status VHiveTableWriter::_filter_block(doris::Block& block, 
const IColumn::Filte
     ColumnsWithTypeAndName result_columns;
     for (int i = 0; i < columns_with_type_and_name.size(); ++i) {
         const auto& col = columns_with_type_and_name[i];
-        
result_columns.emplace_back(col.column->clone_resized(col.column->size()), 
col.type,
-                                    col.name);
+        // Keep the input owner so filtering copies only this partition's 
selected rows.
+        result_columns.emplace_back(col.column, col.type, col.name);
     }
     *output_block = {std::move(result_columns)};
 
diff --git a/be/src/exprs/function/comparison_equal_for_null.cpp 
b/be/src/exprs/function/comparison_equal_for_null.cpp
index 32ffc7b1d88..fa2f67cefff 100644
--- a/be/src/exprs/function/comparison_equal_for_null.cpp
+++ b/be/src/exprs/function/comparison_equal_for_null.cpp
@@ -115,7 +115,7 @@ public:
                     nullable_right_col = assert_cast<const 
ColumnNullable*>(col_right.column.get());
                     // left column is all null, so result has same nullmap 
with right column.
                     block.get_by_position(result).column =
-                            nullable_right_col->get_null_map_column().clone();
+                            nullable_right_col->get_null_map_column_ptr();
                 }
             }
             return Status::OK();
@@ -138,7 +138,7 @@ public:
                     nullable_left_col = assert_cast<const 
ColumnNullable*>(col_left.column.get());
                     // right column is all null, so result has same nullmap 
with left column.
                     block.get_by_position(result).column =
-                            nullable_left_col->get_null_map_column().clone();
+                            nullable_left_col->get_null_map_column_ptr();
                 }
             }
             return Status::OK();
diff --git a/be/src/format/transformer/vorc_transformer.cpp 
b/be/src/format/transformer/vorc_transformer.cpp
index 6750e46ff07..03d3d187dea 100644
--- a/be/src/format/transformer/vorc_transformer.cpp
+++ b/be/src/format/transformer/vorc_transformer.cpp
@@ -773,9 +773,8 @@ static Status normalize_iceberg_nullable_column(const 
ColumnPtr& column, const D
     
RETURN_IF_ERROR(normalize_iceberg_binary_column(nullable_column.get_nested_column_ptr(),
                                                     remove_nullable(type), 
nested_field,
                                                     &nested_column, 
combined_skipped_rows));
-    *normalized_column = ColumnNullable::create(
-            IColumn::mutate(std::move(nested_column)),
-            
IColumn::mutate(nullable_column.get_null_map_column_ptr()->clone()));
+    *normalized_column =
+            ColumnNullable::create(nested_column, 
nullable_column.get_null_map_column_ptr());
     return Status::OK();
 }
 
@@ -894,8 +893,7 @@ static Status normalize_iceberg_array_column(const 
ColumnPtr& column, const Data
             array_column.get_data_ptr(), array_type.get_nested_type(),
             nested_field.field_type()->as_list_type()->element_field(), 
&elements,
             expanded_skipped_rows));
-    *normalized_column = 
ColumnArray::create(IColumn::mutate(std::move(elements)),
-                                             
array_column.get_offsets_ptr()->clone());
+    *normalized_column = ColumnArray::create(elements, 
array_column.get_offsets_ptr());
     return Status::OK();
 }
 
@@ -917,9 +915,7 @@ static Status normalize_iceberg_map_column(const ColumnPtr& 
column, const DataTy
     RETURN_IF_ERROR(normalize_iceberg_binary_column(
             map_column.get_values_ptr(), map_type.get_value_type(), 
iceberg_map->value_field(),
             &values, expanded_skipped_rows));
-    *normalized_column =
-            ColumnMap::create(IColumn::mutate(std::move(keys)), 
IColumn::mutate(std::move(values)),
-                              map_column.get_offsets_ptr()->clone());
+    *normalized_column = ColumnMap::create(keys, values, 
map_column.get_offsets_ptr());
     return Status::OK();
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to