Copilot commented on code in PR #16567:
URL: https://github.com/apache/pinot/pull/16567#discussion_r2265523053


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/MailboxService.java:
##########
@@ -78,16 +78,17 @@ public MailboxService(String hostname, int port, 
PinotConfiguration config, @Nul
     _port = port;
     _config = config;
     _tlsConfig = tlsConfig;
-    _channelManager = new ChannelManager(tlsConfig);
+    int maxInboundMessageSize = config.getProperty(
+        
CommonConstants.MultiStageQueryRunner.KEY_OF_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES,
+        
CommonConstants.MultiStageQueryRunner.DEFAULT_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES
+    );

Review Comment:
   The `getProperty` method call should include proper type casting or 
validation. The configuration value should be explicitly cast to int or use a 
type-safe getter method to avoid potential ClassCastException.
   ```suggestion
       Object maxInboundMessageSizeObj = config.getProperty(
           
CommonConstants.MultiStageQueryRunner.KEY_OF_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES,
           
CommonConstants.MultiStageQueryRunner.DEFAULT_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES
       );
       int maxInboundMessageSize;
       if (maxInboundMessageSizeObj instanceof Number) {
         maxInboundMessageSize = ((Number) maxInboundMessageSizeObj).intValue();
       } else if (maxInboundMessageSizeObj instanceof String) {
         try {
           maxInboundMessageSize = Integer.parseInt((String) 
maxInboundMessageSizeObj);
         } catch (NumberFormatException e) {
           maxInboundMessageSize = 
CommonConstants.MultiStageQueryRunner.DEFAULT_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES;
           LOGGER.warn("Invalid value for {}: '{}', using default: {}",
               
CommonConstants.MultiStageQueryRunner.KEY_OF_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES,
               maxInboundMessageSizeObj,
               maxInboundMessageSize);
         }
       } else {
         maxInboundMessageSize = 
CommonConstants.MultiStageQueryRunner.DEFAULT_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES;
         LOGGER.warn("Unexpected type for {}: '{}', using default: {}",
             
CommonConstants.MultiStageQueryRunner.KEY_OF_MAX_INBOUND_QUERY_DATA_BLOCK_SIZE_BYTES,
             maxInboundMessageSizeObj,
             maxInboundMessageSize);
       }
   ```



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