kmozaid commented on code in PR #16836:
URL: https://github.com/apache/pinot/pull/16836#discussion_r2453851410


##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AvgMVAggregationFunction.java:
##########
@@ -43,8 +44,25 @@ public AggregationFunctionType getType() {
   public void aggregate(int length, AggregationResultHolder 
aggregationResultHolder,
       Map<ExpressionContext, BlockValSet> blockValSetMap) {
     BlockValSet blockValSet = blockValSetMap.get(_expression);
-    double[][] valuesArray = blockValSet.getDoubleValuesMV();
 
+    if (blockValSet.isSingleValue()) {
+      // StarTree pre-aggregated values: During StarTree creation, the 
multi-value column is pre-aggregated per StarTree
+      // node, resulting in a single value per node.
+      byte[][] bytesValues = blockValSet.getBytesValuesSV();
+      AvgPair avgPair = new AvgPair();
+      forEachNotNull(length, blockValSet, (from, to) -> {

Review Comment:
   Yes, pre-aggregated values can't be null. I followed the 
[AvgAggregationFunction](https://github.com/apache/pinot/blob/master/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AvgAggregationFunction.java#L84)
 existing code base, which handles serialized avg-pair same way. I can remove 
`forEachNotNull` if you need to me :) 



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