Gabriel39 commented on code in PR #45375: URL: https://github.com/apache/doris/pull/45375#discussion_r1946312906
########## be/src/pipeline/exec/exchange_sink_operator.cpp: ########## @@ -121,37 +142,41 @@ Status ExchangeSinkLocalState::init(RuntimeState* state, LocalSinkStateInfo& inf _sink_buffer->set_dependency(state->fragment_instance_id().lo, _queue_dependency, this); } - if (_part_type == TPartitionType::HASH_PARTITIONED) { - _partition_count = channels.size(); - _partitioner = - std::make_unique<vectorized::Crc32HashPartitioner<vectorized::ShuffleChannelIds>>( - channels.size()); - RETURN_IF_ERROR(_partitioner->init(p._texprs)); - RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc)); - _profile->add_info_string("Partitioner", - fmt::format("Crc32HashPartitioner({})", _partition_count)); - } else if (_part_type == TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED) { + int num_dests = cast_set<int>(p._dests.size()); + const int free_block_limit = 0; + if (num_dests == 1 || _part_type == TPartitionType::UNPARTITIONED) { + _exchanger = BroadcastExchanger<SerializedBlockQueue<BroadcastBlock>>::create_shared( + 1, num_dests, free_block_limit); + _channel_selector = std::make_unique<AllChannelsSelector>(channels.size()); + } + switch (_part_type) { + case TPartitionType::HASH_PARTITIONED: + case TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED: _partition_count = channels.size(); _partitioner = - std::make_unique<vectorized::Crc32HashPartitioner<vectorized::ShuffleChannelIds>>( - channels.size()); - RETURN_IF_ERROR(_partitioner->init(p._texprs)); - RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc)); - _profile->add_info_string("Partitioner", - fmt::format("Crc32HashPartitioner({})", _partition_count)); - } else if (_part_type == TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) { + vectorized::Crc32HashPartitioner<vectorized::ShuffleChannelIds>::create_unique( + _partition_count); + if (_partition_count != 1) { + _exchanger = ShuffleExchanger<SerializedBlockQueue<PartitionedBlock>>::create_shared( + 1, _partition_count, _partition_count, free_block_limit); + _channel_selector = std::make_unique<SelectedChannelsSelector>(_partition_count); + } + break; + case TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED: Review Comment: tablet sink是内表导入,table sink是外表导入 -- 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