adonis0147 commented on code in PR #9505:
URL: https://github.com/apache/incubator-doris/pull/9505#discussion_r870918568


##########
be/src/exec/broker_scanner.h:
##########
@@ -110,7 +110,7 @@ class BrokerScanner : public BaseScanner {
     int _line_delimiter_length;
 
     // Reader
-    FileReader* _cur_file_reader;
+    std::shared_ptr<FileReader> _cur_file_reader;

Review Comment:
   If the ownership of `_cur_file_reader` is unsharable, using 
`std::unique_ptr` is better accoding to 
[CppCoreGuidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r21-prefer-unique_ptr-over-shared_ptr-unless-you-need-to-share-ownership).
 
   `std::shared_ptr` has some performance overhead. We should not mix the 
ownership and the access of the resource, otherwise, the `std::shared_ptr` will 
pollute lots of code.



##########
be/src/exec/broker_scanner.h:
##########
@@ -110,7 +110,7 @@ class BrokerScanner : public BaseScanner {
     int _line_delimiter_length;
 
     // Reader
-    FileReader* _cur_file_reader;
+    std::shared_ptr<FileReader> _cur_file_reader;

Review Comment:
   If the ownership of `_cur_file_reader` is unsharable, using 
`std::unique_ptr` is better according to 
[CppCoreGuidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r21-prefer-unique_ptr-over-shared_ptr-unless-you-need-to-share-ownership).
 
   `std::shared_ptr` has some performance overhead. We should not mix the 
ownership and the access of the resource, otherwise, the `std::shared_ptr` will 
pollute lots of 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: [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