yashmayya commented on code in PR #15308:
URL: https://github.com/apache/pinot/pull/15308#discussion_r2010088867
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/array/ArrayAggDistinctDoubleFunction.java:
##########
@@ -39,14 +39,15 @@ public void aggregate(int length, AggregationResultHolder
aggregationResultHolde
Map<ExpressionContext, BlockValSet> blockValSetMap) {
BlockValSet blockValSet = blockValSetMap.get(_expression);
double[] value = blockValSet.getDoubleValuesSV();
- DoubleOpenHashSet valueArray = new DoubleOpenHashSet(length);
+ DoubleOpenHashSet valueSet = aggregationResultHolder.getResult() != null ?
aggregationResultHolder.getResult()
+ : new DoubleOpenHashSet(length);
Review Comment:
We're updating `valueSet` inside the lambda function for `forEachNotNull` so
it needs to be effectively final. In your suggested pattern, we'd need to
unnecessarily copy it to an effectively final variable (no impact in terms of
perf, but looks ugly). IMO, the current way looks cleaner overall so I'm gonna
merge this. If you disagree, I'd be happy to open a follow-up PR.
--
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]