Copilot commented on code in PR #3575:
URL: https://github.com/apache/celeborn/pull/3575#discussion_r2810937431


##########
cpp/celeborn/client/ShuffleClient.cpp:
##########
@@ -57,7 +58,16 @@ ShuffleClientImpl::ShuffleClientImpl(
     : appUniqueId_(appUniqueId),
       conf_(conf),
       clientFactory_(clientEndpoint.clientFactory()),
-      pushDataRetryPool_(clientEndpoint.pushDataRetryPool()) {
+      pushDataRetryPool_(clientEndpoint.pushDataRetryPool()),
+      shuffleCompressionEnabled_(
+          conf->shuffleCompressionCodec() != protocol::CompressionCodec::NONE),
+      compressorFactory_(
+          shuffleCompressionEnabled_
+              ? std::function<std::unique_ptr<compress::Compressor>()>(
+                    [conf]() {
+                      return compress::Compressor::createCompressor(*conf);
+                    })
+              : std::function<std::unique_ptr<compress::Compressor>()>()) {

Review Comment:
   The constructor initialization list order does not match the member 
declaration order in the header file. In ShuffleClient.h, members are declared 
in this order: appUniqueId_, shuffleCompressionEnabled_, conf_, clientFactory_, 
pushDataRetryPool_. However, in the constructor initialization list, they are 
initialized as: appUniqueId_, conf_, clientFactory_, pushDataRetryPool_, 
shuffleCompressionEnabled_. Members are always initialized in declaration order 
regardless of the initialization list order, which can cause issues when 
members depend on each other. This violates C++ best practices and may trigger 
-Wreorder warnings. Reorder the initialization list to match the declaration 
order in the header.



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

Reply via email to