mrhhsg commented on code in PR #69690:
URL: https://github.com/apache/doris/pull/69690#discussion_r4398096509


##########
be/src/exprs/function/array/function_array_distinct.h:
##########
@@ -188,18 +190,18 @@ class FunctionArrayDistinct : public IFunction {
         return true;
     }
 
+    template <bool batch_copy>
     bool _execute_string(const IColumn& src_column, const 
ColumnArray::Offsets64& src_offsets,
                          IColumn& dest_column, ColumnArray::Offsets64& 
dest_offsets,
                          const NullMapType* src_null_map, NullMapType* 
dest_null_map) const {
-        const auto* src_data_concrete = reinterpret_cast<const 
ColumnString*>(&src_column);
-        if (!src_data_concrete) {
-            return false;
-        }
-
-        auto& dest_column_string = 
reinterpret_cast<ColumnString&>(dest_column);
+        const auto& src_data_concrete = assert_cast<const 
ColumnString&>(src_column);
+        auto& dest_column_string = assert_cast<ColumnString&>(dest_column);
         ColumnString::Chars& column_string_chars = 
dest_column_string.get_chars();
         ColumnString::Offsets& column_string_offsets = 
dest_column_string.get_offsets();
-        column_string_chars.reserve(src_column.size());
+        IColumn::Selector selector;

Review Comment:
   `selector` 在 `batch_copy` 为 true 时,可以提前 reserve 一下



##########
be/src/exprs/function/array/function_array_distinct.h:
##########
@@ -217,25 +219,30 @@ class FunctionArrayDistinct : public IFunction {
                 }
                 if (src_null_map && (*src_null_map)[j]) {
                     DCHECK(dest_null_map != nullptr);
-                    // Note: here we need to update the offset of ColumnString
-                    
column_string_offsets.push_back(column_string_offsets.back());
+                    if constexpr (batch_copy) {
+                        
selector.push_back(static_cast<IColumn::ColumnIndex>(j));

Review Comment:
   这个逻辑应该是走不到的



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to