From 6dc53b311c568e29a6937fdd5f17a5623d14533f Mon Sep 17 00:00:00 2001 From: Justin Borromeo Date: Wed, 6 Mar 2019 10:34:13 -0800 Subject: [PATCH] Improved test and appeased TeamCity --- .../java/org/apache/druid/query/scan/ScanQuery.java | 10 ---------- .../druid/query/scan/ScanQueryRunnerFactoryTest.java | 9 +++++++-- 2 files changed, 7 insertions(+), 12 deletions(-) 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 eacfcee6c1f..f484e0d0c7f 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 @@ -75,11 +75,6 @@ public class ScanQuery extends BaseQuery return RESULT_FORMAT_LIST; } } - - public byte[] getCacheKey() - { - return new byte[]{(byte) this.ordinal()}; - } } public enum TimeOrder @@ -100,11 +95,6 @@ public class ScanQuery extends BaseQuery { return valueOf(StringUtils.toUpperCase(name)); } - - public byte[] getCacheKey() - { - return new byte[]{(byte) this.ordinal()}; - } } /** diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerFactoryTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerFactoryTest.java index a6d4f9de797..b1e9d8ed9c6 100644 --- a/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerFactoryTest.java +++ b/processing/src/test/java/org/apache/druid/query/scan/ScanQueryRunnerFactoryTest.java @@ -101,7 +101,7 @@ public class ScanQueryRunnerFactoryTest List srvs = new ArrayList<>(numElements); List expectedEventTimestamps = new ArrayList<>(); for (int i = 0; i < numElements; i++) { - long timestamp = (long) (ThreadLocalRandom.current().nextLong()); + long timestamp = (ThreadLocalRandom.current().nextLong()); expectedEventTimestamps.add(timestamp); srvs.add(ScanQueryTestHelper.generateScanResultValue(timestamp, resultFormat, 1)); } @@ -136,7 +136,7 @@ public class ScanQueryRunnerFactoryTest // check total # of rows <= limit Assert.assertTrue(output.size() <= query.getLimit()); - // check ordering and values are correct + // check ordering is correct for (int i = 1; i < output.size(); i++) { if (query.getTimeOrder().equals(ScanQuery.TimeOrder.DESCENDING)) { Assert.assertTrue(output.get(i).getFirstEventTimestamp(resultFormat) < @@ -146,5 +146,10 @@ public class ScanQueryRunnerFactoryTest output.get(i - 1).getFirstEventTimestamp(resultFormat)); } } + + // check the values are correct + for(int i = 0; i < query.getLimit() && i < output.size(); i++) { + Assert.assertEquals((long) expectedEventTimestamps.get(i), output.get(i).getFirstEventTimestamp(resultFormat)); + } } }