Jackie-Jiang commented on code in PR #10799: URL: https://github.com/apache/pinot/pull/10799#discussion_r1204887917
########## pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/AggregationUtils.java: ########## @@ -54,54 +54,92 @@ public static Key extractEmptyKey() { return new Key(new Object[0]); } - private static Object mergeSum(Object left, Object right) { - return ((Number) left).doubleValue() + ((Number) right).doubleValue(); + // TODO: Use the correct type for SUM/MIN/MAX instead of always using double + + @Nullable + private static Object mergeSum(@Nullable Object agg, @Nullable Object value) { + if (agg == null) { + return value; + } + if (value == null) { + return agg; + } + return ((Number) agg).doubleValue() + ((Number) value).doubleValue(); } - private static Object mergeMin(Object left, Object right) { - return Math.min(((Number) left).doubleValue(), ((Number) right).doubleValue()); + @Nullable + private static Object mergeMin(@Nullable Object agg, @Nullable Object value) { + if (agg == null) { + return value; + } + if (value == null) { + return agg; + } + return Math.min(((Number) agg).doubleValue(), ((Number) value).doubleValue()); } - private static Object mergeMax(Object left, Object right) { - return Math.max(((Number) left).doubleValue(), ((Number) right).doubleValue()); + @Nullable + private static Object mergeMax(@Nullable Object agg, @Nullable Object value) { + if (agg == null) { Review Comment: Correct. If null handling is enabled, `null` should be properly set into the `Object[]`, and the null bitmap is already dropped -- 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...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org