From f0eddee66598095a767a1570516c5af59e58e2f6 Mon Sep 17 00:00:00 2001 From: Justin Borromeo Date: Mon, 11 Feb 2019 10:18:45 -0800 Subject: [PATCH] Added more javadoc --- .../query/scan/ScanQueryQueryToolChest.java | 17 +++++++++++------ .../ScanResultValueTimestampComparator.java | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java index 863f4b944cd..309d29a2372 100644 --- a/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java +++ b/processing/src/main/java/org/apache/druid/query/scan/ScanQueryQueryToolChest.java @@ -100,19 +100,19 @@ public class ScanQueryQueryToolChest extends QueryToolChest scanResultIterator = scanQueryLimitRowIteratorMaker.make(); return new BaseSequence( - new BaseSequence.IteratorMaker() + new BaseSequence.IteratorMaker() { @Override - public ScanBatchedTimeOrderedQueueIterator make() + public ScanBatchedTimeOrderedIterator make() { - return new ScanBatchedTimeOrderedQueueIterator( + return new ScanBatchedTimeOrderedIterator( sortScanResultValues(scanResultIterator, scanQuery), scanQuery.getBatchSize() ); } @Override - public void cleanup(ScanBatchedTimeOrderedQueueIterator iterFromMake) + public void cleanup(ScanBatchedTimeOrderedIterator iterFromMake) { CloseQuietly.close(iterFromMake); } @@ -197,12 +197,17 @@ public class ScanQueryQueryToolChest extends QueryToolChest + /** + * This iterator supports iteration through any Iterable and aggregates events in the Iterable into ScanResultValues + * with {int batchSize} events. The columns from the first event per ScanResultValue will be used to populate the + * column section. + */ + private static class ScanBatchedTimeOrderedIterator implements CloseableIterator { private final Iterator itr; private final int batchSize; - public ScanBatchedTimeOrderedQueueIterator(Iterator iterator, int batchSize) + public ScanBatchedTimeOrderedIterator(Iterator iterator, int batchSize) { this.itr = iterator; this.batchSize = batchSize; diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanResultValueTimestampComparator.java b/processing/src/main/java/org/apache/druid/query/scan/ScanResultValueTimestampComparator.java index 66894ae3557..289a1cddf80 100644 --- a/processing/src/main/java/org/apache/druid/query/scan/ScanResultValueTimestampComparator.java +++ b/processing/src/main/java/org/apache/druid/query/scan/ScanResultValueTimestampComparator.java @@ -50,8 +50,8 @@ public class ScanResultValueTimestampComparator implements Comparator) ((List) o1.getEvents()).get(0)).get(ColumnHolder.TIME_COLUMN_NAME), - (Long) ((Map) ((List) o2.getEvents()).get(0)).get(ColumnHolder.TIME_COLUMN_NAME) + (Long) ((Map) ((List) o1.getEvents()).get(0)).get(ColumnHolder.TIME_COLUMN_NAME), + (Long) ((Map) ((List) o2.getEvents()).get(0)).get(ColumnHolder.TIME_COLUMN_NAME) ); } else if (scanQuery.getResultFormat().equals(ScanQuery.RESULT_FORMAT_COMPACTED_LIST)) { int val1TimeColumnIndex = o1.getColumns().indexOf(ColumnHolder.TIME_COLUMN_NAME);