Jackie-Jiang commented on code in PR #11365:
URL: https://github.com/apache/pinot/pull/11365#discussion_r1299318701


##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/VarianceAggregationFunction.java:
##########
@@ -134,12 +169,7 @@ public void aggregateGroupByMV(int length, int[][] 
groupKeysArray, GroupByResult
 
   @Override
   public VarianceTuple extractAggregationResult(AggregationResultHolder 
aggregationResultHolder) {
-    VarianceTuple varianceTuple = aggregationResultHolder.getResult();
-    if (varianceTuple == null) {
-      return new VarianceTuple(0L, 0.0, 0.0);
-    } else {
-      return varianceTuple;
-    }
+    return aggregationResultHolder.getResult();

Review Comment:
   Do we need to check if `_nullHandlingEnabled` is set? Will it break if it is 
not set and this returns `null`?



##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/VarianceAggregationFunction.java:
##########
@@ -116,8 +139,20 @@ protected void setGroupByResult(int groupKey, 
GroupByResultHolder groupByResultH
   public void aggregateGroupBySV(int length, int[] groupKeyArray, 
GroupByResultHolder groupByResultHolder,
       Map<ExpressionContext, BlockValSet> blockValSetMap) {
     double[] values = 
StatisticalAggregationFunctionUtils.getValSet(blockValSetMap, _expression);
-    for (int i = 0; i < length; i++) {
-      setGroupByResult(groupKeyArray[i], groupByResultHolder, 1L, values[i], 
0.0);
+    RoaringBitmap nullBitmap = null;
+    if (_nullHandlingEnabled) {
+      nullBitmap = blockValSetMap.get(_expression).getNullBitmap();
+    }
+    if (nullBitmap != null && !nullBitmap.isEmpty()) {
+      for (int i = 0; i < length; i++) {
+        if (!nullBitmap.contains(i)) {
+          setGroupByResult(groupKeyArray[i], groupByResultHolder, 1L, 
values[i], 0.0);
+        }
+      }
+    } else {
+      for (int i = 0; i < length; i++) {
+        setGroupByResult(groupKeyArray[i], groupByResultHolder, 1L, values[i], 
0.0);
+      }

Review Comment:
   We need to also add similar logic to `aggregateGroupByMV`. We don't support 
MV as null right now, but we should support regular MV group key



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