HappenLee commented on code in PR #25596:
URL: https://github.com/apache/doris/pull/25596#discussion_r1364823693


##########
be/src/vec/runtime/partitioner.cpp:
##########
@@ -0,0 +1,101 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "partitioner.h"
+
+#include "runtime/thread_context.h"
+#include "vec/columns/column_const.h"
+
+namespace doris::vectorized {
+
+Status HashPartitioner::do_partitioning(RuntimeState* state, Block* block,
+                                        MemTracker* mem_tracker) const {
+    // will only copy schema
+    // we don't want send temp columns
+    auto column_to_keep = block->columns();
+
+    int result_size = _partition_expr_ctxs.size();
+    int result[result_size];
+
+    // vectorized calculate hash
+    int rows = block->rows();
+    _hash_vals.resize(rows);
+    auto* __restrict hashes = _hash_vals.data();
+
+    if (rows > 0) {
+        {
+            SCOPED_CONSUME_MEM_TRACKER(mem_tracker);
+            RETURN_IF_ERROR(_get_partition_column_result(block, result));
+        }
+        SCOPED_TIMER(*_split_block_hash_compute_timer);
+        // result[j] means column index, i means rows index, here to calculate 
the xxhash value
+        for (int j = 0; j < result_size; ++j) {
+            // complex type most not implement get_data_at() method which 
column_const will call
+            unpack_if_const(block->get_by_position(result[j]).column)

Review Comment:
   abstract the function



-- 
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

Reply via email to