mirror of https://github.com/apache/druid.git
Revert "fix npe in topNBinaryFn with post aggs"
This reverts commit bbedde3418
.
This commit is contained in:
parent
357cd66f66
commit
7bafb71841
|
@ -90,19 +90,7 @@ public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<To
|
||||||
TopNResultValue arg2Vals = arg2.getValue();
|
TopNResultValue arg2Vals = arg2.getValue();
|
||||||
|
|
||||||
for (DimensionAndMetricValueExtractor arg1Val : arg1Vals) {
|
for (DimensionAndMetricValueExtractor arg1Val : arg1Vals) {
|
||||||
final String dimensionValue = arg1Val.getStringDimensionValue(dimension);
|
retVals.put(arg1Val.getStringDimensionValue(dimension), arg1Val);
|
||||||
Map<String, Object> retVal = new LinkedHashMap<String, Object>(aggregations.size() + 2);
|
|
||||||
retVal.put(dimension, dimensionValue);
|
|
||||||
|
|
||||||
for (AggregatorFactory factory : aggregations) {
|
|
||||||
final String metricName = factory.getName();
|
|
||||||
retVal.put(metricName, arg1Val.getMetric(metricName));
|
|
||||||
}
|
|
||||||
for (PostAggregator postAgg : postAggregations) {
|
|
||||||
retVal.put(postAgg.getName(), postAgg.compute(retVal));
|
|
||||||
}
|
|
||||||
|
|
||||||
retVals.put(dimensionValue, new DimensionAndMetricValueExtractor(retVal));
|
|
||||||
}
|
}
|
||||||
for (DimensionAndMetricValueExtractor arg2Val : arg2Vals) {
|
for (DimensionAndMetricValueExtractor arg2Val : arg2Vals) {
|
||||||
final String dimensionValue = arg2Val.getStringDimensionValue(dimension);
|
final String dimensionValue = arg2Val.getStringDimensionValue(dimension);
|
||||||
|
@ -124,18 +112,7 @@ public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<To
|
||||||
|
|
||||||
retVals.put(dimensionValue, new DimensionAndMetricValueExtractor(retVal));
|
retVals.put(dimensionValue, new DimensionAndMetricValueExtractor(retVal));
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> retVal = new LinkedHashMap<String, Object>(aggregations.size() + 2);
|
retVals.put(dimensionValue, arg2Val);
|
||||||
retVal.put(dimension, dimensionValue);
|
|
||||||
|
|
||||||
for (AggregatorFactory factory : aggregations) {
|
|
||||||
final String metricName = factory.getName();
|
|
||||||
retVal.put(metricName, arg2Val.getMetric(metricName));
|
|
||||||
}
|
|
||||||
for (PostAggregator postAgg : postAggregations) {
|
|
||||||
retVal.put(postAgg.getName(), postAgg.compute(retVal));
|
|
||||||
}
|
|
||||||
|
|
||||||
retVals.put(dimensionValue, new DimensionAndMetricValueExtractor(retVal));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,9 +324,9 @@ public class TopNBinaryFnTest
|
||||||
"testdim", "2"
|
"testdim", "2"
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"rows", 4L,
|
"rows", 0L,
|
||||||
"index", 5L,
|
"index", 1L,
|
||||||
"testdim", "other"
|
"testdim", "3"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -336,12 +336,6 @@ public class TopNBinaryFnTest
|
||||||
currTime,
|
currTime,
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
ImmutableList.<Map<String, Object>>of(
|
ImmutableList.<Map<String, Object>>of(
|
||||||
ImmutableMap.<String, Object>of(
|
|
||||||
"testdim", "other",
|
|
||||||
"rows", 4L,
|
|
||||||
"index", 5L,
|
|
||||||
"addrowsindexconstant", 10.0
|
|
||||||
),
|
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"testdim", "1",
|
"testdim", "1",
|
||||||
"rows", 3L,
|
"rows", 3L,
|
||||||
|
@ -363,7 +357,7 @@ public class TopNBinaryFnTest
|
||||||
QueryGranularity.ALL,
|
QueryGranularity.ALL,
|
||||||
new DefaultDimensionSpec("testdim", null),
|
new DefaultDimensionSpec("testdim", null),
|
||||||
new NumericTopNMetricSpec("addrowsindexconstant"),
|
new NumericTopNMetricSpec("addrowsindexconstant"),
|
||||||
3,
|
2,
|
||||||
aggregatorFactories,
|
aggregatorFactories,
|
||||||
postAggregators
|
postAggregators
|
||||||
).apply(
|
).apply(
|
||||||
|
|
Loading…
Reference in New Issue