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


##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -724,4 +741,35 @@ DataDistribution 
ExchangeSinkOperatorX::required_data_distribution() const {
     return 
DataSinkOperatorX<ExchangeSinkLocalState>::required_data_distribution();
 }
 
+std::shared_ptr<ExchangeSinkBuffer> ExchangeSinkOperatorX::_create_buffer(
+        const std::vector<InstanceLoId>& sender_ins_ids) {
+    PUniqueId id;
+    id.set_hi(_state->query_id().hi);
+    id.set_lo(_state->query_id().lo);
+    auto sink_buffer =
+            std::make_unique<ExchangeSinkBuffer>(id, _dest_node_id, state(), 
sender_ins_ids);
+    for (const auto& _dest : _dests) {
+        sink_buffer->construct_request(_dest.fragment_instance_id);
+    }
+    return sink_buffer;
+}
+
+/// TODO: Modify this to let FE handle the judgment instead of BE.
+std::shared_ptr<ExchangeSinkBuffer> ExchangeSinkOperatorX::get_sink_buffer(
+        InstanceLoId sender_ins_id) {
+    if (!_child) {
+        throw doris::Exception(ErrorCode::INTERNAL_ERROR,
+                               "ExchangeSinkOperatorX did not correctly set 
the child.");
+    }
+    if (std::dynamic_pointer_cast<SortSourceOperatorX>(_child)) {

Review Comment:
   better `if (_state->enable_shared_exchange_sink_buffer()
   && ! std::dynamic_pointer_cast<LocalExchangeSourceOperatorX>(_child)) && 
!std::dynamic_pointer_cast<SortSourceOperatorX>(_child))`
   
   And add enough comment for the code



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