Merge pull request #2348 from AlexanderSaydakov/fix-aggregator-test-helper

fixed createIndex
This commit is contained in:
Himanshu 2016-01-28 16:01:36 -06:00
commit edd7ce58aa
1 changed files with 8 additions and 10 deletions

View File

@ -314,22 +314,20 @@ public class AggregationTestHelper
index = new OnheapIncrementalIndex(minTimestamp, gran, metrics, deserializeComplexMetrics, maxRowCount); index = new OnheapIncrementalIndex(minTimestamp, gran, metrics, deserializeComplexMetrics, maxRowCount);
while (rows.hasNext()) { while (rows.hasNext()) {
Object row = rows.next(); Object row = rows.next();
try { if (!index.canAppendRow()) {
if (row instanceof String && parser instanceof StringInputRowParser) {
//Note: this is required because StringInputRowParser is InputRowParser<ByteBuffer> as opposed to
//InputRowsParser<String>
index.add(((StringInputRowParser) parser).parse((String) row));
} else {
index.add(parser.parse(row));
}
}
catch (IndexSizeExceededException ex) {
File tmp = tempFolder.newFolder(); File tmp = tempFolder.newFolder();
toMerge.add(tmp); toMerge.add(tmp);
indexMerger.persist(index, tmp, new IndexSpec()); indexMerger.persist(index, tmp, new IndexSpec());
index.close(); index.close();
index = new OnheapIncrementalIndex(minTimestamp, gran, metrics, deserializeComplexMetrics, maxRowCount); index = new OnheapIncrementalIndex(minTimestamp, gran, metrics, deserializeComplexMetrics, maxRowCount);
} }
if (row instanceof String && parser instanceof StringInputRowParser) {
//Note: this is required because StringInputRowParser is InputRowParser<ByteBuffer> as opposed to
//InputRowsParser<String>
index.add(((StringInputRowParser) parser).parse((String) row));
} else {
index.add(parser.parse(row));
}
} }
if (toMerge.size() > 0) { if (toMerge.size() > 0) {