github-actions[bot] commented on code in PR #29641:
URL: https://github.com/apache/doris/pull/29641#discussion_r1616752062


##########
be/src/pipeline/dependency.cpp:
##########
@@ -196,6 +196,82 @@ LocalExchangeSharedState::LocalExchangeSharedState(int 
num_instances) {
     mem_trackers.resize(num_instances, nullptr);
 }
 
+vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
+    return std::visit(
+            vectorized::Overload {
+                    [&](std::monostate& arg) {
+                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, 
"uninited hash table");
+                        return vectorized::MutableColumns();
+                    },
+                    [&](auto&& agg_method) -> vectorized::MutableColumns {
+                        vectorized::MutableColumns key_columns;
+                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
+                            key_columns.emplace_back(
+                                    
probe_expr_ctxs[i]->root()->data_type()->create_column());
+                        }
+                        auto& data = *agg_method.hash_table;
+                        bool has_null_key = data.has_null_key_data();
+                        const auto size = data.size() - has_null_key;
+                        using KeyType = 
std::decay_t<decltype(agg_method.iterator->get_first())>;
+                        std::vector<KeyType> keys(size);
+
+                        size_t num_rows = 0;
+                        auto iter = aggregate_data_container->begin();
+                        {
+                            while (iter != aggregate_data_container->end()) {
+                                keys[num_rows] = iter.get_key<KeyType>();
+                                ++iter;
+                                ++num_rows;
+                            }
+                        }
+                        agg_method.insert_keys_into_columns(keys, key_columns, 
num_rows);
+                        if (has_null_key) {
+                            key_columns[0]->insert_data(nullptr, 0);
+                        }
+                        return key_columns;
+                    }},
+            agg_data->method_variant);
+}
+
+void AggSharedState::build_limit_heap(size_t hash_table_size) {

Review Comment:
   warning: method 'build_limit_heap' can be made const 
[readability-make-member-function-const]
   
   ```suggestion
   void AggSharedState::build_limit_heap(size_t hash_table_size) const {
   ```
   
   be/src/pipeline/dependency.h:314:
   ```diff
   -     void build_limit_heap(size_t hash_table_size);
   +     void build_limit_heap(size_t hash_table_size) const;
   ```
   



##########
be/src/pipeline/exec/aggregation_sink_operator.cpp:
##########
@@ -538,6 +565,108 @@ void 
AggSinkLocalState::_emplace_into_hash_table(vectorized::AggregateDataPtr* p
                _agg_data->method_variant);
 }
 
+bool 
AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateDataPtr* 
places,

Review Comment:
   warning: function '_emplace_into_hash_table_limit' exceeds recommended 
size/complexity thresholds [readability-function-size]
   ```cpp
   bool 
AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateDataPtr* 
places,
                           ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/pipeline/exec/aggregation_sink_operator.cpp:567:** 96 lines 
including whitespace and comments (threshold 80)
   ```cpp
   bool 
AggSinkLocalState::_emplace_into_hash_table_limit(vectorized::AggregateDataPtr* 
places,
                           ^
   ```
   
   </details>
   



##########
be/src/pipeline/exec/aggregation_source_operator.cpp:
##########
@@ -446,10 +445,19 @@ Status AggSourceOperatorX::get_block(RuntimeState* state, 
vectorized::Block* blo
     local_state.make_nullable_output_key(block);
     // dispose the having clause, should not be execute in prestreaming agg
     RETURN_IF_ERROR(vectorized::VExprContext::filter_block(_conjuncts, block, 
block->columns()));
-    local_state.reached_limit(block, eos);
+    local_state.do_agg_limit(block, eos);
     return Status::OK();
 }
 
+void AggLocalState::do_agg_limit(vectorized::Block* block, bool* eos) {

Review Comment:
   warning: pointer parameter 'eos' can be pointer to const 
[readability-non-const-parameter]
   
   ```suggestion
   void AggLocalState::do_agg_limit(vectorized::Block* block, const bool* eos) {
   ```
   
   be/src/pipeline/exec/aggregation_source_operator.h:43:
   ```diff
   -     void do_agg_limit(vectorized::Block* block, bool* eos);
   +     void do_agg_limit(vectorized::Block* block, const bool* eos);
   ```
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to