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


##########
be/src/pipeline/pipeline.h:
##########
@@ -117,6 +117,8 @@ class Pipeline : public 
std::enable_shared_from_this<Pipeline> {
     }
 
     [[nodiscard]] PipelineId id() const { return _pipeline_id; }
+    void set_is_root_pipeline() { _is_root_pipeline = true; }
+    bool is_root_pipeline() const { return _is_root_pipeline; }

Review Comment:
   warning: function 'is_root_pipeline' should be marked [[nodiscard]] 
[modernize-use-nodiscard]
   
   ```suggestion
       [[nodiscard]] bool is_root_pipeline() const { return _is_root_pipeline; }
   ```
   



##########
be/src/runtime/query_statistics.cpp:
##########
@@ -20,6 +20,8 @@
 #include <gen_cpp/data.pb.h>

Review Comment:
   warning: 'gen_cpp/data.pb.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/data.pb.h>
            ^
   ```
   



##########
be/src/runtime/query_statistics.cpp:
##########
@@ -98,24 +107,17 @@ QueryStatistics::~QueryStatistics() {
 
 void QueryStatisticsRecvr::insert(const PQueryStatistics& statistics, int 
sender_id) {
     std::lock_guard<SpinLock> l(_lock);
-    QueryStatistics* query_statistics = nullptr;
-    auto iter = _query_statistics.find(sender_id);
-    if (iter == _query_statistics.end()) {
-        query_statistics = new QueryStatistics;
-        _query_statistics[sender_id] = query_statistics;
-    } else {
-        query_statistics = iter->second;
+    if (!_query_statistics.contains(sender_id)) {
+        _query_statistics[sender_id] = std::make_shared<QueryStatistics>();
     }
-    query_statistics->from_pb(statistics);
+    _query_statistics[sender_id]->from_pb(statistics);
 }
 
-QueryStatisticsRecvr::~QueryStatisticsRecvr() {
-    // It is unnecessary to lock here, because the destructor will be
-    // called alter DataStreamRecvr's close in ExchangeNode.
-    for (auto& pair : _query_statistics) {
-        delete pair.second;
-    }
-    _query_statistics.clear();
+void QueryStatisticsRecvr::insert(QueryStatisticsPtr statistics, int 
sender_id) {
+    if (!statistics->collected()) return;
+    if (_query_statistics.contains(sender_id)) return;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
       if (_query_statistics.contains(sender_id)) { return;
   }
   ```
   



##########
be/src/runtime/query_statistics.cpp:
##########
@@ -98,24 +107,17 @@ QueryStatistics::~QueryStatistics() {
 
 void QueryStatisticsRecvr::insert(const PQueryStatistics& statistics, int 
sender_id) {
     std::lock_guard<SpinLock> l(_lock);
-    QueryStatistics* query_statistics = nullptr;
-    auto iter = _query_statistics.find(sender_id);
-    if (iter == _query_statistics.end()) {
-        query_statistics = new QueryStatistics;
-        _query_statistics[sender_id] = query_statistics;
-    } else {
-        query_statistics = iter->second;
+    if (!_query_statistics.contains(sender_id)) {
+        _query_statistics[sender_id] = std::make_shared<QueryStatistics>();
     }
-    query_statistics->from_pb(statistics);
+    _query_statistics[sender_id]->from_pb(statistics);
 }
 
-QueryStatisticsRecvr::~QueryStatisticsRecvr() {
-    // It is unnecessary to lock here, because the destructor will be
-    // called alter DataStreamRecvr's close in ExchangeNode.
-    for (auto& pair : _query_statistics) {
-        delete pair.second;
-    }
-    _query_statistics.clear();
+void QueryStatisticsRecvr::insert(QueryStatisticsPtr statistics, int 
sender_id) {
+    if (!statistics->collected()) return;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
       if (!statistics->collected()) { return;
   }
   ```
   



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