walterddr commented on code in PR #10799:
URL: https://github.com/apache/pinot/pull/10799#discussion_r1204900676
##########
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:
> when the data is sent from leaf to intermediate, the null values will be
correctly set to null in the `List<Object[]>`? Thus making a simple null check
like this good enough?
this statement is not entirely true.
- when sent, the data is still Ser/De into bitmap (see `DataBlock`)
- when used, it is pulled from `TransferableBlock` which has 2 member
variable format: (1) `DataBlock _dataBlock` format and (2) `List<Object[]>
_container`
- it is when the lazy eval of the `_container` getter that puts the null in
the right place
--
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]