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

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 693181465ab [Improvement](column) optimize 
append_data_by_selector_impl (#54216)
693181465ab is described below

commit 693181465abcf7585df8a3a4eb1a5ca3efd57786
Author: Pxl <[email protected]>
AuthorDate: Mon Aug 4 11:25:03 2025 +0800

    [Improvement](column) optimize append_data_by_selector_impl (#54216)
    
    ```sql
    select  a  from  t_str_key  group  by  a;
    before:
    -  InsertKeysToColumnTime:  1sec7ms
    after:
    -  InsertKeysToColumnTime:  298.209ms
    ```
    
    change ColumnIndex from uint64 to uint32 coz insert_indices_from use
    uint32 as input arguments
---
 be/src/vec/columns/column.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h
index 3350752252f..b8b88217ea9 100644
--- a/be/src/vec/columns/column.h
+++ b/be/src/vec/columns/column.h
@@ -478,7 +478,7 @@ public:
       * Selector must contain values from 0 to num_columns - 1.
       * For default implementation, see column_impl.h
       */
-    using ColumnIndex = UInt64;
+    using ColumnIndex = UInt32;
     using Selector = PaddedPODArray<ColumnIndex>;
 
     // The append_data_by_selector function requires the column to implement 
the insert_from function.
@@ -669,14 +669,7 @@ protected:
         }
         DCHECK_GE(end, begin);
         DCHECK_LE(end, selector.size());
-        // here wants insert some value from this column, and the nums is (end 
- begin)
-        // and many be this column num_rows is 4096, but only need insert num 
is (1 - 0) = 1
-        // so can't call res->reserve(num_rows), it's will be too mush waste 
memory
-        res->reserve(res->size() + (end - begin));
-
-        for (size_t i = begin; i < end; ++i) {
-            static_cast<Derived&>(*res).insert_from(*this, selector[i]);
-        }
+        static_cast<Derived&>(*res).insert_indices_from(*this, 
&selector[begin], &selector[end]);
     }
     template <typename Derived>
     void insert_from_multi_column_impl(const std::vector<const IColumn*>& srcs,


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

Reply via email to