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


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/aggregator/MinMaxRangeValueAggregator.java:
##########
@@ -38,7 +39,10 @@ public DataType getAggregatedValueType() {
   }
 
   @Override
-  public MinMaxRangePair getInitialAggregatedValue(Object rawValue) {
+  public MinMaxRangePair getInitialAggregatedValue(@Nullable Object rawValue) {
+    if (rawValue == null) {
+      return new MinMaxRangePair();

Review Comment:
   Creating a MinMaxRangePair with no arguments when rawValue is null may not 
represent the correct initial state. The constructor should likely initialize 
with appropriate default values (e.g., Double.POSITIVE_INFINITY for min, 
Double.NEGATIVE_INFINITY for max) to ensure proper aggregation behavior.
   ```suggestion
         return new MinMaxRangePair(Double.POSITIVE_INFINITY, 
Double.NEGATIVE_INFINITY);
   ```



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/aggregator/AvgValueAggregator.java:
##########
@@ -38,7 +39,10 @@ public DataType getAggregatedValueType() {
   }
 
   @Override
-  public AvgPair getInitialAggregatedValue(Object rawValue) {
+  public AvgPair getInitialAggregatedValue(@Nullable Object rawValue) {
+    if (rawValue == null) {
+      return new AvgPair();

Review Comment:
   Creating an AvgPair with no arguments when rawValue is null may not 
represent the correct initial state for average calculations. The constructor 
should initialize with appropriate values (likely sum=0, count=0) to ensure 
correct averaging behavior when subsequent values are aggregated.
   ```suggestion
         return new AvgPair(0.0, 0L);
   ```



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