mirror of https://github.com/apache/druid.git
Fixed codestyle and forbidden API errors
This commit is contained in:
parent
148939e88b
commit
dfe4aa9681
|
@ -165,14 +165,14 @@ public class ScanQueryQueryToolChest extends QueryToolChest<ScanResultValue, Sca
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
Iterator<ScanResultValue> heapsortScanResultValues(Iterator<ScanResultValue> inputIterator, ScanQuery scanQuery) {
|
Iterator<ScanResultValue> heapsortScanResultValues(Iterator<ScanResultValue> inputIterator, ScanQuery scanQuery)
|
||||||
|
{
|
||||||
Comparator<ScanResultValue> priorityQComparator = new ScanResultValueTimestampComparator(scanQuery);
|
Comparator<ScanResultValue> priorityQComparator = new ScanResultValueTimestampComparator(scanQuery);
|
||||||
|
|
||||||
// Converting the limit from long to int could theoretically throw an ArithmeticException but this branch
|
// Converting the limit from long to int could theoretically throw an ArithmeticException but this branch
|
||||||
// only runs if limit < MAX_LIMIT_FOR_IN_MEMORY_TIME_ORDERING (which should be < Integer.MAX_VALUE)
|
// only runs if limit < MAX_LIMIT_FOR_IN_MEMORY_TIME_ORDERING (which should be < Integer.MAX_VALUE)
|
||||||
|
|
||||||
PriorityQueue<ScanResultValue> q = new PriorityQueue<>
|
PriorityQueue<ScanResultValue> q = new PriorityQueue<>(Math.toIntExact(scanQuery.getLimit()), priorityQComparator);
|
||||||
(Math.toIntExact(scanQuery.getLimit()), priorityQComparator);
|
|
||||||
|
|
||||||
while (inputIterator.hasNext()) {
|
while (inputIterator.hasNext()) {
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,8 @@ public class ScanQueryQueryToolChestTest
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryRunner<T> lookup(
|
public <T> QueryRunner<T> lookup(
|
||||||
Query<T> query, QuerySegmentWalker walker
|
Query<T> query,
|
||||||
|
QuerySegmentWalker walker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -138,7 +139,8 @@ public class ScanQueryQueryToolChestTest
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryRunner<T> lookup(
|
public <T> QueryRunner<T> lookup(
|
||||||
Query<T> query, QuerySegmentWalker walker
|
Query<T> query,
|
||||||
|
QuerySegmentWalker walker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -188,7 +190,8 @@ public class ScanQueryQueryToolChestTest
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryRunner<T> lookup(
|
public <T> QueryRunner<T> lookup(
|
||||||
Query<T> query, QuerySegmentWalker walker
|
Query<T> query,
|
||||||
|
QuerySegmentWalker walker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -238,7 +241,8 @@ public class ScanQueryQueryToolChestTest
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryRunner<T> lookup(
|
public <T> QueryRunner<T> lookup(
|
||||||
Query<T> query, QuerySegmentWalker walker
|
Query<T> query,
|
||||||
|
QuerySegmentWalker walker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.apache.druid.query.scan;
|
package org.apache.druid.query.scan;
|
||||||
|
|
||||||
|
import org.apache.druid.java.util.common.DateTimes;
|
||||||
import org.apache.druid.query.Druids;
|
import org.apache.druid.query.Druids;
|
||||||
import org.apache.druid.query.spec.MultipleIntervalSegmentSpec;
|
import org.apache.druid.query.spec.MultipleIntervalSegmentSpec;
|
||||||
import org.apache.druid.query.spec.QuerySegmentSpec;
|
import org.apache.druid.query.spec.QuerySegmentSpec;
|
||||||
|
@ -38,8 +39,13 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
private static QuerySegmentSpec intervalSpec;
|
private static QuerySegmentSpec intervalSpec;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public void setup() {
|
public void setup()
|
||||||
intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(new Interval(0, 1)));
|
{
|
||||||
|
intervalSpec = new MultipleIntervalSegmentSpec(
|
||||||
|
Collections.singletonList(
|
||||||
|
new Interval(DateTimes.of("2012-01-01"), DateTimes.of("2012-01-01").plusHours(1))
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +61,7 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
|
|
||||||
ScanResultValueTimestampComparator comparator = new ScanResultValueTimestampComparator(query);
|
ScanResultValueTimestampComparator comparator = new ScanResultValueTimestampComparator(query);
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> events1 = new ArrayList<>();
|
ArrayList<HashMap<String, Object>> events1 = new ArrayList<>();` `
|
||||||
HashMap<String, Object> event1 = new HashMap<>();
|
HashMap<String, Object> event1 = new HashMap<>();
|
||||||
event1.put(ColumnHolder.TIME_COLUMN_NAME, new Long(42));
|
event1.put(ColumnHolder.TIME_COLUMN_NAME, new Long(42));
|
||||||
events1.add(event1);
|
events1.add(event1);
|
||||||
|
@ -63,7 +69,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s1 = new ScanResultValue(
|
ScanResultValue s1 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events1);
|
events1
|
||||||
|
);
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> events2 = new ArrayList<>();
|
ArrayList<HashMap<String, Object>> events2 = new ArrayList<>();
|
||||||
HashMap<String, Object> event2 = new HashMap<>();
|
HashMap<String, Object> event2 = new HashMap<>();
|
||||||
|
@ -73,7 +80,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s2 = new ScanResultValue(
|
ScanResultValue s2 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events2);
|
events2
|
||||||
|
);
|
||||||
|
|
||||||
Assert.assertEquals(1, comparator.compare(s1, s2));
|
Assert.assertEquals(1, comparator.compare(s1, s2));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +106,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s1 = new ScanResultValue(
|
ScanResultValue s1 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events1);
|
events1
|
||||||
|
);
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> events2 = new ArrayList<>();
|
ArrayList<HashMap<String, Object>> events2 = new ArrayList<>();
|
||||||
HashMap<String, Object> event2 = new HashMap<>();
|
HashMap<String, Object> event2 = new HashMap<>();
|
||||||
|
@ -108,7 +117,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s2 = new ScanResultValue(
|
ScanResultValue s2 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events2);
|
events2
|
||||||
|
);
|
||||||
|
|
||||||
Assert.assertEquals(-1, comparator.compare(s1, s2));
|
Assert.assertEquals(-1, comparator.compare(s1, s2));
|
||||||
}
|
}
|
||||||
|
@ -132,7 +142,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s1 = new ScanResultValue(
|
ScanResultValue s1 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events1);
|
events1
|
||||||
|
);
|
||||||
|
|
||||||
List<List<Object>> events2 = new ArrayList<>();
|
List<List<Object>> events2 = new ArrayList<>();
|
||||||
List<Object> event2 = Collections.singletonList(new Long(43));
|
List<Object> event2 = Collections.singletonList(new Long(43));
|
||||||
|
@ -141,7 +152,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s2 = new ScanResultValue(
|
ScanResultValue s2 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events2);
|
events2
|
||||||
|
);
|
||||||
|
|
||||||
Assert.assertEquals(1, comparator.compare(s1, s2));
|
Assert.assertEquals(1, comparator.compare(s1, s2));
|
||||||
}
|
}
|
||||||
|
@ -165,7 +177,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s1 = new ScanResultValue(
|
ScanResultValue s1 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events1);
|
events1
|
||||||
|
);
|
||||||
|
|
||||||
List<List<Object>> events2 = new ArrayList<>();
|
List<List<Object>> events2 = new ArrayList<>();
|
||||||
List<Object> event2 = Collections.singletonList(new Long(43));
|
List<Object> event2 = Collections.singletonList(new Long(43));
|
||||||
|
@ -174,7 +187,8 @@ public class ScanResultValueTimestampComparatorTest
|
||||||
ScanResultValue s2 = new ScanResultValue(
|
ScanResultValue s2 = new ScanResultValue(
|
||||||
"segmentId",
|
"segmentId",
|
||||||
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
Collections.singletonList(ColumnHolder.TIME_COLUMN_NAME),
|
||||||
events2);
|
events2
|
||||||
|
);
|
||||||
|
|
||||||
Assert.assertEquals(-1, comparator.compare(s1, s2));
|
Assert.assertEquals(-1, comparator.compare(s1, s2));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue