Skip to content

Commit

Permalink
HighestCurrent may return wrong result
Browse files Browse the repository at this point in the history
Because of DataPoints maybe empty and AggregationIterator.hasNextValue() will skip empty item.

Signed-off-by: Chris Larsen <[email protected]>
  • Loading branch information
opsun authored and manolama committed May 21, 2018
1 parent a733c22 commit 58ab435
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/query/expression/HighestCurrent.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ public DataPoints[] evaluate(final TSQuery data_query,
MutableDataPoint.ofLongValue(point.timestamp(), point.longValue())
: MutableDataPoint.ofDoubleValue(point.timestamp(), point.doubleValue()));
}
post_agg_results[ix++] = new PostAggregatedDataPoints(dps,
mutable_points.toArray(new DataPoint[mutable_points.size()]));
// Because of AggregationIterator.hasNextValue() will skip empty item.
if (mutable_points.size() > 0) {
post_agg_results[ix++] = new PostAggregatedDataPoints(dps,
mutable_points.toArray(new DataPoint[mutable_points.size()]));
}
}
}
num_results = ix;

final SeekableView[] views = new SeekableView[num_results];
for (int i = 0; i < num_results; i++) {
Expand Down

0 comments on commit 58ab435

Please sign in to comment.