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


##########
be/src/vec/sink/writer/vtablet_writer.cpp:
##########
@@ -1313,47 +1313,72 @@ Status VTabletWriter::_incremental_open_node_channel(
     return Status::OK();
 }
 
+// Generate channel payload for sinking data to differenct node channel
+// Payload = std::pair<std::unique_ptr<vectorized::IColumn::Selector>, 
std::vector<int64_t>>;
+//   first = row_id, second = vector<tablet_id>
 void VTabletWriter::_generate_row_distribution_payload(
-        ChannelDistributionPayload& channel_to_payload, const 
VOlapTablePartition* partition,
-        uint32_t tablet_index, int row_idx, size_t row_cnt) {
-    // Generate channel payload for sinking data to differenct node channel
-    for (int j = 0; j < partition->indexes.size(); ++j) {
-        auto tid = partition->indexes[j].tablets[tablet_index];
-        auto it = _channels[j]->_channels_by_tablet.find(tid);
-        DCHECK(it != _channels[j]->_channels_by_tablet.end())
-                << "unknown tablet, tablet_id=" << tablet_index;
-        for (const auto& channel : it->second) {
-            if (channel_to_payload[j].count(channel.get()) < 1) {
-                channel_to_payload[j].insert(
-                        {channel.get(), Payload 
{std::unique_ptr<vectorized::IColumn::Selector>(
-                                                         new 
vectorized::IColumn::Selector()),
-                                                 std::vector<int64_t>()}});
+        ChannelDistributionPayload& channel_to_payload,
+        const std::vector<VOlapTablePartition*>& partitions,
+        const std::vector<uint32_t>& tablet_indexes, const std::vector<bool>& 
skip,
+        size_t row_cnt) {
+    for (int row_idx = 0; row_idx < row_cnt; row_idx++) {
+        if (skip[row_idx]) {
+            continue;
+        }
+        const auto& partition = partitions[row_idx];
+        const auto& tablet_index = tablet_indexes[row_idx];
+
+        for (int index_num = 0; index_num < partition->indexes.size();
+             ++index_num) { // partition->indexes = [index, tablets...]
+
+            auto tablet_id = 
partition->indexes[index_num].tablets[tablet_index];
+            auto it = _channels[index_num]->_channels_by_tablet.find(
+                    tablet_id); // (tablet_id, VNodeChannel) where this tablet 
locate
+            std::vector<std::shared_ptr<VNodeChannel>>& tablet_locations = 
it->second;
+
+            DCHECK(it != _channels[index_num]->_channels_by_tablet.end())

Review Comment:
   DCHECK should before than `std::vector<std::shared_ptr<VNodeChannel>>& 
tablet_locations = it->second;`



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