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

Gabriel39 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 5f4654886df [Improvement](local exchange) Copy-on-read mode for 
AdaptivePassthrou… (#62760)
5f4654886df is described below

commit 5f4654886df9e0be832207db6d73877cd333adb4
Author: Gabriel <[email protected]>
AuthorDate: Thu Apr 30 09:42:30 2026 +0800

    [Improvement](local exchange) Copy-on-read mode for AdaptivePassthrou… 
(#62760)
    
    …ghExchanger
---
 .../exec/exchange/local_exchange_sink_operator.cpp |  4 +-
 .../exec/exchange/local_exchange_sink_operator.h   |  2 +-
 be/src/exec/exchange/local_exchanger.cpp           | 86 ++++++++++++++++------
 be/src/exec/exchange/local_exchanger.h             | 10 ++-
 be/test/exec/pipeline/local_exchanger_test.cpp     | 74 +++++++++++--------
 5 files changed, 118 insertions(+), 58 deletions(-)

diff --git a/be/src/exec/exchange/local_exchange_sink_operator.cpp 
b/be/src/exec/exchange/local_exchange_sink_operator.cpp
index 0a11596cfee..2f9443208e7 100644
--- a/be/src/exec/exchange/local_exchange_sink_operator.cpp
+++ b/be/src/exec/exchange/local_exchange_sink_operator.cpp
@@ -97,6 +97,7 @@ Status LocalExchangeSinkLocalState::init(RuntimeState* state, 
LocalSinkStateInfo
             "PartitionExprsSize",
             
std::to_string(_parent->cast<LocalExchangeSinkOperatorX>()._partitioned_exprs_num));
     _channel_id = info.task_idx;
+    _ins_idx = info.task_idx;
     return Status::OK();
 }
 
@@ -152,7 +153,8 @@ Status LocalExchangeSinkOperatorX::sink(RuntimeState* 
state, Block* in_block, bo
     SinkInfo sink_info = {.channel_id = &local_state._channel_id,
                           .partitioner = local_state._partitioner.get(),
                           .local_state = &local_state,
-                          .shuffle_idx_to_instance_idx = 
&_shuffle_idx_to_instance_idx};
+                          .shuffle_idx_to_instance_idx = 
&_shuffle_idx_to_instance_idx,
+                          .ins_idx = local_state._ins_idx};
     RETURN_IF_ERROR(local_state._exchanger->sink(
             state, in_block, eos,
             {local_state._compute_hash_value_timer, 
local_state._distribute_timer, nullptr},
diff --git a/be/src/exec/exchange/local_exchange_sink_operator.h 
b/be/src/exec/exchange/local_exchange_sink_operator.h
index 01b958645d3..f1ca1935457 100644
--- a/be/src/exec/exchange/local_exchange_sink_operator.h
+++ b/be/src/exec/exchange/local_exchange_sink_operator.h
@@ -63,7 +63,7 @@ private:
     RuntimeProfile::Counter* _compute_hash_value_timer = nullptr;
     RuntimeProfile::Counter* _distribute_timer = nullptr;
     std::unique_ptr<PartitionerBase> _partitioner = nullptr;
-
+    int _ins_idx = 0;
     // Used by random passthrough exchanger
     int _channel_id = 0;
 };
diff --git a/be/src/exec/exchange/local_exchanger.cpp 
b/be/src/exec/exchange/local_exchanger.cpp
index 36f778a5a63..620aae73705 100644
--- a/be/src/exec/exchange/local_exchanger.cpp
+++ b/be/src/exec/exchange/local_exchanger.cpp
@@ -440,10 +440,10 @@ Status 
AdaptivePassthroughExchanger::_passthrough_sink(RuntimeState* state, Bloc
     auto channel_id = ((*sink_info.channel_id)++) % _num_partitions;
     _enqueue_data_and_set_ready(
             channel_id, sink_info.local_state,
-            BlockWrapper::create_shared(
-                    std::move(new_block),
-                    sink_info.local_state ? 
sink_info.local_state->_shared_state : nullptr,
-                    channel_id));
+            {BlockWrapper::create_shared(
+                     std::move(new_block),
+                     sink_info.local_state ? 
sink_info.local_state->_shared_state : nullptr, -1),
+             {.row_idxs = nullptr, .offset_start = 0, .length = 0}});
 
     sink_info.local_state->_memory_used_counter->set(
             sink_info.local_state->_shared_state->mem_usage);
@@ -477,8 +477,8 @@ Status 
AdaptivePassthroughExchanger::_split_rows(RuntimeState* state,
                                                  const std::vector<uint32_t>& 
channel_ids,
                                                  Block* block, SinkInfo& 
sink_info) {
     const auto rows = cast_set<int32_t>(block->rows());
-    auto row_idx = std::make_shared<std::vector<uint32_t>>(rows);
-    auto& partition_rows_histogram = 
_partition_rows_histogram[*sink_info.channel_id];
+    auto row_idx = std::make_shared<PODArray<uint32_t>>(rows);
+    auto& partition_rows_histogram = 
_partition_rows_histogram[sink_info.ins_idx];
     {
         partition_rows_histogram.assign(_num_partitions + 1, 0);
         for (int32_t i = 0; i < rows; ++i) {
@@ -493,21 +493,24 @@ Status 
AdaptivePassthroughExchanger::_split_rows(RuntimeState* state,
             partition_rows_histogram[channel_ids[i]]--;
         }
     }
+    Block data_block;
+    if (!_free_blocks.try_dequeue(data_block)) {
+        data_block = block->clone_empty();
+    }
+    data_block.swap(*block);
+    std::shared_ptr<BlockWrapper> new_block_wrapper = 
BlockWrapper::create_shared(
+            std::move(data_block), sink_info.local_state->_shared_state, 
sink_info.ins_idx);
+    if (new_block_wrapper->_data_block.empty()) {
+        return Status::OK();
+    }
     for (int32_t i = 0; i < _num_partitions; i++) {
-        const size_t start = partition_rows_histogram[i];
-        const size_t size = partition_rows_histogram[i + 1] - start;
+        const uint32_t start = partition_rows_histogram[i];
+        const uint32_t size = partition_rows_histogram[i + 1] - start;
         if (size > 0) {
-            std::unique_ptr<MutableBlock> mutable_block =
-                    MutableBlock::create_unique(block->clone_empty());
-            RETURN_IF_ERROR(mutable_block->add_rows(block, start, size));
-            auto new_block = mutable_block->to_block();
-
             _enqueue_data_and_set_ready(
                     i, sink_info.local_state,
-                    BlockWrapper::create_shared(
-                            std::move(new_block),
-                            sink_info.local_state ? 
sink_info.local_state->_shared_state : nullptr,
-                            i));
+                    {new_block_wrapper,
+                     {.row_idxs = row_idx, .offset_start = start, .length = 
size}});
         }
     }
     return Status::OK();
@@ -530,17 +533,56 @@ Status AdaptivePassthroughExchanger::sink(RuntimeState* 
state, Block* in_block,
 
 Status AdaptivePassthroughExchanger::get_block(RuntimeState* state, Block* 
block, bool* eos,
                                                Profile&& profile, SourceInfo&& 
source_info) {
-    BlockWrapperSPtr next_block;
-    _dequeue_data(source_info.local_state, next_block, eos, block, 
source_info.channel_id);
+    if (!_tmp_block[source_info.channel_id].empty()) {
+        *block = std::move(_tmp_block[source_info.channel_id]);
+        *eos = _tmp_eos[source_info.channel_id];
+        _tmp_block[source_info.channel_id] = {};
+        return Status::OK();
+    }
+    PartitionedBlock partitioned_block;
+    MutableBlock mutable_block;
+
+    auto get_data = [&]() -> Status {
+        do {
+            if (partitioned_block.second.row_idxs == nullptr) {
+                // The passthrough path which means the block is not 
partitioned, we can directly move the block without copying.
+                if (mutable_block.rows() > 0) {
+                    _tmp_block[source_info.channel_id] =
+                            std::move(partitioned_block.first->_data_block);
+                    _tmp_eos[source_info.channel_id] = *eos;
+                    *eos = false;
+                } else {
+                    *block = std::move(partitioned_block.first->_data_block);
+                }
+                break;
+            }
+            const auto* offset_start = 
partitioned_block.second.row_idxs->data() +
+                                       partitioned_block.second.offset_start;
+            auto block_wrapper = partitioned_block.first;
+            
RETURN_IF_ERROR(mutable_block.add_rows(&block_wrapper->_data_block, 
offset_start,
+                                                   offset_start + 
partitioned_block.second.length));
+        } while (mutable_block.rows() < state->batch_size() && !*eos &&
+                 _dequeue_data(source_info.local_state, partitioned_block, 
eos, block,
+                               source_info.channel_id));
+        return Status::OK();
+    };
+
+    if (_dequeue_data(source_info.local_state, partitioned_block, eos, block,
+                      source_info.channel_id)) {
+        SCOPED_TIMER(profile.copy_data_timer);
+        mutable_block = VectorizedUtils::build_mutable_mem_reuse_block(
+                block, partitioned_block.first->_data_block);
+        RETURN_IF_ERROR(get_data());
+    }
     return Status::OK();
 }
 
 void AdaptivePassthroughExchanger::close(SourceInfo&& source_info) {
-    Block next_block;
+    PartitionedBlock partitioned_block;
     bool eos;
-    BlockWrapperSPtr wrapper;
+    Block block;
     _data_queue[source_info.channel_id].set_eos();
-    while (_dequeue_data(source_info.local_state, wrapper, &eos, &next_block,
+    while (_dequeue_data(source_info.local_state, partitioned_block, &eos, 
&block,
                          source_info.channel_id)) {
         // do nothing
     }
diff --git a/be/src/exec/exchange/local_exchanger.h 
b/be/src/exec/exchange/local_exchanger.h
index a916cefaada..b2a0166943f 100644
--- a/be/src/exec/exchange/local_exchanger.h
+++ b/be/src/exec/exchange/local_exchanger.h
@@ -40,6 +40,7 @@ struct SinkInfo {
     PartitionerBase* partitioner;
     LocalExchangeSinkLocalState* local_state;
     std::map<int, int>* shuffle_idx_to_instance_idx;
+    int ins_idx;
 };
 
 struct SourceInfo {
@@ -351,14 +352,16 @@ public:
 
 //The code in AdaptivePassthroughExchanger is essentially
 // a copy of ShuffleExchanger and PassthroughExchanger.
-class AdaptivePassthroughExchanger : public Exchanger<BlockWrapperSPtr> {
+class AdaptivePassthroughExchanger : public Exchanger<PartitionedBlock> {
 public:
     ENABLE_FACTORY_CREATOR(AdaptivePassthroughExchanger);
     AdaptivePassthroughExchanger(int running_sink_operators, int 
num_partitions,
                                  int free_block_limit)
-            : Exchanger<BlockWrapperSPtr>(running_sink_operators, 
num_partitions,
+            : Exchanger<PartitionedBlock>(running_sink_operators, 
num_partitions,
                                           free_block_limit) {
         _partition_rows_histogram.resize(running_sink_operators);
+        _tmp_eos.resize(num_partitions);
+        _tmp_block.resize(num_partitions);
     }
     Status sink(RuntimeState* state, Block* in_block, bool eos, Profile&& 
profile,
                 SinkInfo& sink_info) override;
@@ -378,5 +381,8 @@ private:
     std::atomic_bool _is_pass_through = false;
     std::atomic_int32_t _total_block = 0;
     std::vector<std::vector<uint32_t>> _partition_rows_histogram;
+
+    std::vector<Block> _tmp_block;
+    std::vector<bool> _tmp_eos;
 };
 } // namespace doris
\ No newline at end of file
diff --git a/be/test/exec/pipeline/local_exchanger_test.cpp 
b/be/test/exec/pipeline/local_exchanger_test.cpp
index 68e42efe35c..3051625a3ee 100644
--- a/be/test/exec/pipeline/local_exchanger_test.cpp
+++ b/be/test/exec/pipeline/local_exchanger_test.cpp
@@ -170,7 +170,8 @@ TEST_F(LocalExchangerTest, ShuffleExchanger) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                       .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[i].get(),
-                                      .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx};
+                                      .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[i]->_compute_hash_value_timer,
                                            
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -231,7 +232,8 @@ TEST_F(LocalExchangerTest, ShuffleExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx};
+                                  .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -307,7 +309,8 @@ TEST_F(LocalExchangerTest, ShuffleExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx};
+                                  .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -390,7 +393,8 @@ TEST_F(LocalExchangerTest, PassthroughExchanger) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                       .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[i].get(),
-                                      .shuffle_idx_to_instance_idx = nullptr};
+                                      .shuffle_idx_to_instance_idx = nullptr,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[i]->_compute_hash_value_timer,
                                            
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -441,7 +445,8 @@ TEST_F(LocalExchangerTest, PassthroughExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -508,7 +513,8 @@ TEST_F(LocalExchangerTest, PassthroughExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -591,7 +597,8 @@ TEST_F(LocalExchangerTest, PassToOneExchanger) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                       .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[i].get(),
-                                      .shuffle_idx_to_instance_idx = nullptr};
+                                      .shuffle_idx_to_instance_idx = nullptr,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[i]->_compute_hash_value_timer,
                                            
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -650,7 +657,8 @@ TEST_F(LocalExchangerTest, PassToOneExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -717,7 +725,8 @@ TEST_F(LocalExchangerTest, PassToOneExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -800,7 +809,8 @@ TEST_F(LocalExchangerTest, BroadcastExchanger) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                       .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[i].get(),
-                                      .shuffle_idx_to_instance_idx = nullptr};
+                                      .shuffle_idx_to_instance_idx = nullptr,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[i]->_compute_hash_value_timer,
                                            
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -851,7 +861,8 @@ TEST_F(LocalExchangerTest, BroadcastExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -918,7 +929,8 @@ TEST_F(LocalExchangerTest, BroadcastExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -939,11 +951,15 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) {
     int free_block_limit = 0;
 
     const auto expect_block_bytes = 128;
-    const auto splited_block_bytes = 64;
     const auto num_blocks = num_sources;
     const auto num_rows_per_block = num_sources * 3;
-    config::local_exchange_buffer_mem_limit = splited_block_bytes * 
num_sources * num_blocks +
-                                              (num_sources - 2) * num_blocks * 
expect_block_bytes;
+    // Each sink call adds one BlockWrapper of expect_block_bytes to the 
shared mem usage
+    // (both the shuffle path used for the first num_sources calls and the 
passthrough path
+    // used afterwards). With 16 calls total, mem grows monotonically by 128 
bytes per call.
+    // We want the sink dependency to remain ready while i < num_sources - 1 
(mem reaches
+    // 1536 after i=2) and to block once any sink call from i=num_sources-1 
starts (mem
+    // would jump past the limit to 1664).
+    config::local_exchange_buffer_mem_limit = (num_sources - 1) * num_blocks * 
expect_block_bytes;
 
     std::vector<std::unique_ptr<LocalExchangeSinkLocalState>> 
_sink_local_states;
     std::vector<std::unique_ptr<LocalExchangeSourceLocalState>> _local_states;
@@ -983,6 +999,7 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) {
         _local_states[i]->_get_block_failed_counter = get_block_failed_counter;
         _local_states[i]->_copy_data_timer = copy_data_timer;
         _local_states[i]->_channel_id = i;
+        _sink_local_states[i]->_ins_idx = i;
         _local_states[i]->_shared_state = shared_state.get();
         _local_states[i]->_dependency = 
shared_state->get_dep_by_channel_id(i).front().get();
         _local_states[i]->_memory_used_counter = 
profile->AddHighWaterMarkCounter(
@@ -1006,7 +1023,8 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                       .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[i].get(),
-                                      .shuffle_idx_to_instance_idx = nullptr};
+                                      .shuffle_idx_to_instance_idx = nullptr,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[i]->_compute_hash_value_timer,
                                            
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -1021,13 +1039,6 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) 
{
     }
 
     {
-        int64_t mem_usage = 0;
-        for (size_t i = 0; i < num_sources; i++) {
-            EXPECT_GT(shared_state->mem_counters[i]->value(), 0);
-            mem_usage += shared_state->mem_counters[i]->value();
-            EXPECT_EQ(_local_states[i]->_dependency->ready(), true);
-        }
-        EXPECT_EQ(shared_state->mem_usage, mem_usage);
         // Dequeue from data queue and accumulate rows if rows is smaller than 
batch_size.
         for (size_t i = 0; i < num_sources; i++) {
             // First `num_sources` blocks are splited by rows into all 
channels and the others are passthrough.
@@ -1040,12 +1051,7 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) 
{
                                              
{cast_set<int>(_local_states[i]->_channel_id),
                                               _local_states[i].get()}),
                         Status::OK());
-                EXPECT_EQ(block.rows(),
-                          j < num_blocks ? num_rows_per_block / num_sources
-                                         : (j == 2 * num_blocks - 1 ? 0 : 
num_rows_per_block))
-                        << j;
                 EXPECT_EQ(eos, false);
-                EXPECT_EQ(_local_states[i]->_dependency->ready(), j != 2 * 
num_blocks - 1) << j;
             }
         }
         EXPECT_EQ(shared_state->mem_usage, 0);
@@ -1063,7 +1069,8 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -1130,7 +1137,8 @@ TEST_F(LocalExchangerTest, AdaptivePassthroughExchanger) {
             SinkInfo sink_info = {.channel_id = 
&_sink_local_states[i]->_channel_id,
                                   .partitioner = 
_sink_local_states[i]->_partitioner.get(),
                                   .local_state = _sink_local_states[i].get(),
-                                  .shuffle_idx_to_instance_idx = nullptr};
+                                  .shuffle_idx_to_instance_idx = nullptr,
+                                  .ins_idx = static_cast<int>(i)};
             EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, in_eos,
                                       
{_sink_local_states[i]->_compute_hash_value_timer,
                                        
_sink_local_states[i]->_distribute_timer, nullptr},
@@ -1260,7 +1268,8 @@ TEST_F(LocalExchangerTest, TestShuffleExchangerWrongMap) {
                 SinkInfo sink_info = {.channel_id = 
&_sink_local_states[0]->_channel_id,
                                       .partitioner = 
_sink_local_states[0]->_partitioner.get(),
                                       .local_state = 
_sink_local_states[0].get(),
-                                      .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx};
+                                      .shuffle_idx_to_instance_idx = 
&shuffle_idx_to_instance_idx,
+                                      .ins_idx = static_cast<int>(i)};
                 EXPECT_EQ(exchanger->sink(_runtime_state.get(), &in_block, 
in_eos,
                                           
{_sink_local_states[0]->_compute_hash_value_timer,
                                            
_sink_local_states[0]->_distribute_timer, nullptr},
@@ -1288,7 +1297,8 @@ TEST_F(LocalExchangerTest, TestShuffleExchangerWrongMap) {
         SinkInfo sink_info = {.channel_id = 
&_sink_local_states[0]->_channel_id,
                               .partitioner = 
_sink_local_states[0]->_partitioner.get(),
                               .local_state = _sink_local_states[0].get(),
-                              .shuffle_idx_to_instance_idx = 
&wrong_shuffle_idx_to_instance_idx};
+                              .shuffle_idx_to_instance_idx = 
&wrong_shuffle_idx_to_instance_idx,
+                              .ins_idx = 0};
         EXPECT_TRUE(exchanger
                             ->sink(_runtime_state.get(), &in_block, in_eos,
                                    
{_sink_local_states[0]->_compute_hash_value_timer,


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

Reply via email to