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


##########
be/src/vec/sink/vdata_stream_sender.cpp:
##########
@@ -687,35 +687,43 @@ Status VDataStreamSender::send(RuntimeState* state, 
Block* block, bool eos) {
     } else if (_part_type == TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) {
         // check out of limit
         RETURN_IF_ERROR(_send_new_partition_batch());
-        if (UNLIKELY(block->rows() == 0)) {
-            return Status::OK();
-        }
-        std::shared_ptr<vectorized::Block> convert_block;
-        bool has_filtered_rows = false;
-        int64_t filtered_rows = 0;
-        _number_input_rows += block->rows();
-        RETURN_IF_ERROR(_row_distribution.generate_rows_distribution(
-                *block, convert_block, filtered_rows, has_filtered_rows, 
_row_part_tablet_ids,
-                _number_input_rows));
-
-        const auto& row_ids = _row_part_tablet_ids[0].row_ids;
-        const auto& tablet_ids = _row_part_tablet_ids[0].tablet_ids;
+        std::shared_ptr<vectorized::Block> convert_block = 
std::make_shared<vectorized::Block>();
         const auto& num_channels = _channels.size();
         std::vector<std::vector<uint32>> channel2rows;
         channel2rows.resize(num_channels);
-        for (int idx = 0; idx < row_ids.size(); ++idx) {
-            const auto& row = row_ids[idx];
-            const auto& tablet_id = tablet_ids[idx];
-            channel2rows[tablet_id % num_channels].emplace_back(row);
+        auto input_rows = block->rows();
+
+        if (input_rows > 0) {
+            bool has_filtered_rows = false;
+            int64_t filtered_rows = 0;
+            _number_input_rows += input_rows;
+            RETURN_IF_ERROR(_row_distribution.generate_rows_distribution(
+                    *block, convert_block, filtered_rows, has_filtered_rows, 
_row_part_tablet_ids,
+                    _number_input_rows));
+
+            const auto& row_ids = _row_part_tablet_ids[0].row_ids;
+            const auto& tablet_ids = _row_part_tablet_ids[0].tablet_ids;
+            auto select_rows = row_ids.size();
+            std::vector<uint32_t> crc_hash_vals(select_rows);
+            auto* __restrict crc_hashes = crc_hash_vals.data();
+            for (size_t i = 0; i < select_rows; i++) {
+                crc_hashes[i] =

Review Comment:
   do the same change like upper



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