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


##########
be/src/vec/exec/scan/vscan_node.cpp:
##########
@@ -318,8 +318,8 @@ Status VScanNode::_init_profile() {
     return Status::OK();
 }
 
-Status VScanNode::_start_scanners(const std::list<VScannerSPtr>& scanners,
-                                  const int query_parallel_instance_num) {
+void VScanNode::_start_scanners(const 
std::list<std::shared_ptr<ScannerDelegate>>& scanners,

Review Comment:
   warning: method '_start_scanners' can be made const 
[readability-make-member-function-const]
   
   be/src/vec/exec/scan/vscan_node.cpp:321:
   ```diff
   -                                 const int query_parallel_instance_num) {
   +                                 const int query_parallel_instance_num) 
const {
   ```
   



##########
be/src/vec/exec/scan/vscan_node.h:
##########
@@ -437,8 +448,8 @@
                                       const std::string& fn_name, int 
slot_ref_child = -1);
 
     // Submit the scanner to the thread pool and start execution
-    Status _start_scanners(const std::list<VScannerSPtr>& scanners,
-                           const int query_parallel_instance_num);
+    void _start_scanners(const std::list<std::shared_ptr<ScannerDelegate>>& 
scanners,
+                         const int query_parallel_instance_num);

Review Comment:
   warning: parameter 'query_parallel_instance_num' is const-qualified in the 
function declaration; const-qualification of parameters only has an effect in 
function definitions [readability-avoid-const-params-in-decls]
   
   ```suggestion
                            int query_parallel_instance_num);
   ```
   



##########
be/src/vec/exec/scan/vscan_node.h:
##########
@@ -87,6 +87,16 @@ struct FilterPredicates {
     std::vector<std::pair<std::string, std::shared_ptr<HybridSetBase>>> 
in_filters;
 };
 
+// We want to close scanner automatically, so using a delegate class
+// and call close method in the delegate class's dctor.
+class ScannerDelegate {
+public:
+    VScannerSPtr _scanner;
+    ScannerDelegate(VScannerSPtr& scanner_ptr) : _scanner(scanner_ptr) {}
+    ~ScannerDelegate() { 
static_cast<void>(_scanner->close(_scanner->runtime_state())); }

Review Comment:
   warning: use '= default' to define a trivial destructor 
[modernize-use-equals-default]
   ```cpp
       ~ScannerDelegate() { 
static_cast<void>(_scanner->close(_scanner->runtime_state())); }
       ^
   ```
   



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