Fix integer overflow in SegmentMetadataQuery numRows. (#2890)

This commit is contained in:
Gian Merlino 2016-04-27 14:37:04 -07:00 committed by Xavier Léauté
parent c29cb7d711
commit 90ce03c66f
3 changed files with 5 additions and 5 deletions

View File

@ -76,7 +76,7 @@ public class SegmentAnalyzer
this.analysisTypes = analysisTypes; this.analysisTypes = analysisTypes;
} }
public int numRows(Segment segment) public long numRows(Segment segment)
{ {
return Preconditions.checkNotNull(segment, "segment").asStorageAdapter().getNumRows(); return Preconditions.checkNotNull(segment, "segment").asStorageAdapter().getNumRows();
} }

View File

@ -87,7 +87,7 @@ public class SegmentMetadataQueryRunnerFactory implements QueryRunnerFactory<Seg
SegmentMetadataQuery query = (SegmentMetadataQuery) inQ; SegmentMetadataQuery query = (SegmentMetadataQuery) inQ;
final SegmentAnalyzer analyzer = new SegmentAnalyzer(query.getAnalysisTypes()); final SegmentAnalyzer analyzer = new SegmentAnalyzer(query.getAnalysisTypes());
final Map<String, ColumnAnalysis> analyzedColumns = analyzer.analyze(segment); final Map<String, ColumnAnalysis> analyzedColumns = analyzer.analyze(segment);
final int numRows = analyzer.numRows(segment); final long numRows = analyzer.numRows(segment);
long totalSize = 0; long totalSize = 0;
if (analyzer.analyzingSize()) { if (analyzer.analyzingSize()) {

View File

@ -34,7 +34,7 @@ public class SegmentAnalysis implements Comparable<SegmentAnalysis>
private final List<Interval> interval; private final List<Interval> interval;
private final Map<String, ColumnAnalysis> columns; private final Map<String, ColumnAnalysis> columns;
private final long size; private final long size;
private final int numRows; private final long numRows;
private final Map<String, AggregatorFactory> aggregators; private final Map<String, AggregatorFactory> aggregators;
@JsonCreator @JsonCreator
@ -43,7 +43,7 @@ public class SegmentAnalysis implements Comparable<SegmentAnalysis>
@JsonProperty("intervals") List<Interval> interval, @JsonProperty("intervals") List<Interval> interval,
@JsonProperty("columns") Map<String, ColumnAnalysis> columns, @JsonProperty("columns") Map<String, ColumnAnalysis> columns,
@JsonProperty("size") long size, @JsonProperty("size") long size,
@JsonProperty("numRows") int numRows, @JsonProperty("numRows") long numRows,
@JsonProperty("aggregators") Map<String, AggregatorFactory> aggregators @JsonProperty("aggregators") Map<String, AggregatorFactory> aggregators
) )
{ {
@ -80,7 +80,7 @@ public class SegmentAnalysis implements Comparable<SegmentAnalysis>
} }
@JsonProperty @JsonProperty
public int getNumRows() public long getNumRows()
{ {
return numRows; return numRows;
} }