From b2c8c77ad4ee5a9a273ee7a7870fb2d9b0ec9dd4 Mon Sep 17 00:00:00 2001 From: Justin Borromeo Date: Wed, 6 Feb 2019 17:39:48 -0800 Subject: [PATCH] Fixing tests WIP --- .../java/org/apache/druid/benchmark/query/ScanBenchmark.java | 2 +- processing/src/main/java/org/apache/druid/query/Druids.java | 4 ++-- .../src/main/java/org/apache/druid/query/scan/ScanQuery.java | 4 ++-- .../org/apache/druid/query/scan/ScanQueryQueryToolChest.java | 4 +--- .../apache/druid/query/scan/ScanQueryQueryToolChestTest.java | 2 +- .../java/org/apache/druid/query/scan/ScanQuerySpecTest.java | 4 ++-- .../query/scan/ScanResultValueTimestampComparatorTest.java | 2 +- .../java/org/apache/druid/sql/calcite/rel/DruidQuery.java | 5 +++-- .../java/org/apache/druid/sql/calcite/CalciteQueryTest.java | 2 +- 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/benchmarks/src/main/java/org/apache/druid/benchmark/query/ScanBenchmark.java b/benchmarks/src/main/java/org/apache/druid/benchmark/query/ScanBenchmark.java index bb492f2d9f7..267cea544a3 100644 --- a/benchmarks/src/main/java/org/apache/druid/benchmark/query/ScanBenchmark.java +++ b/benchmarks/src/main/java/org/apache/druid/benchmark/query/ScanBenchmark.java @@ -94,7 +94,7 @@ import java.util.concurrent.TimeUnit; /* Works with 8GB heap size or greater. Otherwise there's a good chance of an OOME. */ @State(Scope.Benchmark) @Fork(value = 1) -@Warmup(iterations = 10) +@Warmup(iterations = 25) @Measurement(iterations = 25) public class ScanBenchmark { diff --git a/processing/src/main/java/org/apache/druid/query/Druids.java b/processing/src/main/java/org/apache/druid/query/Druids.java index dd8b35c3f87..b0fe8edfecc 100644 --- a/processing/src/main/java/org/apache/druid/query/Druids.java +++ b/processing/src/main/java/org/apache/druid/query/Druids.java @@ -950,11 +950,11 @@ public class Druids resultFormat, batchSize, limit, + timeOrder, dimFilter, columns, legacy, - context, - timeOrder + context ); } diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java b/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java index 0b1ee235626..323c0a3246a 100644 --- a/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java +++ b/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java @@ -61,11 +61,11 @@ public class ScanQuery extends BaseQuery @JsonProperty("resultFormat") String resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") long limit, + @JsonProperty("timeOrder") String timeOrder, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List columns, @JsonProperty("legacy") Boolean legacy, - @JsonProperty("context") Map context, - @JsonProperty("timeOrder") String timeOrder + @JsonProperty("context") Map context ) { super(dataSource, querySegmentSpec, false, context); 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 a1b9e149e4a..43a55ea10e9 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 @@ -54,7 +54,6 @@ public class ScanQueryQueryToolChest extends QueryToolChest + private static class ScanBatchedTimeOrderedQueueIterator implements CloseableIterator { private final Iterator itr; private final int batchSize; diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryQueryToolChestTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryQueryToolChestTest.java index 7535e736476..10364ae2743 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryQueryToolChestTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryQueryToolChestTest.java @@ -49,7 +49,7 @@ public class ScanQueryQueryToolChestTest private static QuerySegmentSpec emptySegmentSpec; @BeforeClass - public void setup() + public static void setup() { config = createNiceMock(ScanQueryConfig.class); expect(config.getMaxRowsTimeOrderedInMemory()).andReturn(100000); diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java index e1e322649fb..9cfbade4222 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java @@ -68,11 +68,11 @@ public class ScanQuerySpecTest null, 0, 3, + "none", null, Arrays.asList("market", "quality", "index"), null, - null, - "none" + null ); String actual = jsonMapper.writeValueAsString(query); diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanResultValueTimestampComparatorTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanResultValueTimestampComparatorTest.java index 0de0c34ea7c..005a820ec75 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/ScanResultValueTimestampComparatorTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/ScanResultValueTimestampComparatorTest.java @@ -39,7 +39,7 @@ public class ScanResultValueTimestampComparatorTest private static QuerySegmentSpec intervalSpec; @BeforeClass - public void setup() + public static void setup() { intervalSpec = new MultipleIntervalSegmentSpec( Collections.singletonList( diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java b/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java index 5bdc37c3d66..6cb4eafa412 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java @@ -964,11 +964,12 @@ public class DruidQuery ScanQuery.RESULT_FORMAT_COMPACTED_LIST, 0, scanLimit, + null, // Will default to "none" filtration.getDimFilter(), Ordering.natural().sortedCopy(ImmutableSet.copyOf(outputRowSignature.getRowOrder())), false, - ImmutableSortedMap.copyOf(plannerContext.getQueryContext()), - null // Will default to "none" + ImmutableSortedMap.copyOf(plannerContext.getQueryContext()) + ); } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java index b89ae45a1d4..a0bf8f74fc8 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java @@ -770,7 +770,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest + " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"limit\":9223372036854775807,\"filter\":{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":" + emptyStringEq + ",\"extractionFn\":null}},\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n" - + " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"limit\":9223372036854775807,\"filter\":null,\"columns\":[\"dim1\",\"dim2\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING, dim2:STRING}])\n"; + + " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"limit\":9223372036854775807,\"timeOrder\":\"none\",\"filter\":null,\"columns\":[\"dim1\",\"dim2\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING, dim2:STRING}])\n"; testQuery( PLANNER_CONFIG_FALLBACK,