gortiz commented on code in PR #12252:
URL: https://github.com/apache/pinot/pull/12252#discussion_r1529907210
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/MinMaxRangeAggregationFunction.java:
##########
@@ -61,37 +61,29 @@ public GroupByResultHolder createGroupByResultHolder(int
initialCapacity, int ma
@Override
public void aggregate(int length, AggregationResultHolder
aggregationResultHolder,
Map<ExpressionContext, BlockValSet> blockValSetMap) {
- double min = Double.POSITIVE_INFINITY;
- double max = Double.NEGATIVE_INFINITY;
BlockValSet blockValSet = blockValSetMap.get(_expression);
+ MinMaxRangePair minMax = new MinMaxRangePair(Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY);
Review Comment:
Done
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/MinMaxRangeAggregationFunction.java:
##########
@@ -61,37 +61,29 @@ public GroupByResultHolder createGroupByResultHolder(int
initialCapacity, int ma
@Override
public void aggregate(int length, AggregationResultHolder
aggregationResultHolder,
Map<ExpressionContext, BlockValSet> blockValSetMap) {
- double min = Double.POSITIVE_INFINITY;
- double max = Double.NEGATIVE_INFINITY;
BlockValSet blockValSet = blockValSetMap.get(_expression);
+ MinMaxRangePair minMax = new MinMaxRangePair(Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY);
+
if (blockValSet.getValueType() != DataType.BYTES) {
double[] doubleValues = blockValSet.getDoubleValuesSV();
- for (int i = 0; i < length; i++) {
- double value = doubleValues[i];
- if (value < min) {
- min = value;
- }
- if (value > max) {
- max = value;
+ forEachNotNull(length, blockValSet, (from, to) -> {
+ for (int i = from; i < to; i++) {
+ double value = doubleValues[i];
+ minMax.apply(value, value);
Review Comment:
Done
--
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]