mirror of https://github.com/apache/druid.git
Improved test and appeased TeamCity
This commit is contained in:
parent
35c96d3557
commit
6dc53b311c
|
@ -75,11 +75,6 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
return RESULT_FORMAT_LIST;
|
return RESULT_FORMAT_LIST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getCacheKey()
|
|
||||||
{
|
|
||||||
return new byte[]{(byte) this.ordinal()};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TimeOrder
|
public enum TimeOrder
|
||||||
|
@ -100,11 +95,6 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
{
|
{
|
||||||
return valueOf(StringUtils.toUpperCase(name));
|
return valueOf(StringUtils.toUpperCase(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getCacheKey()
|
|
||||||
{
|
|
||||||
return new byte[]{(byte) this.ordinal()};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class ScanQueryRunnerFactoryTest
|
||||||
List<ScanResultValue> srvs = new ArrayList<>(numElements);
|
List<ScanResultValue> srvs = new ArrayList<>(numElements);
|
||||||
List<Long> expectedEventTimestamps = new ArrayList<>();
|
List<Long> expectedEventTimestamps = new ArrayList<>();
|
||||||
for (int i = 0; i < numElements; i++) {
|
for (int i = 0; i < numElements; i++) {
|
||||||
long timestamp = (long) (ThreadLocalRandom.current().nextLong());
|
long timestamp = (ThreadLocalRandom.current().nextLong());
|
||||||
expectedEventTimestamps.add(timestamp);
|
expectedEventTimestamps.add(timestamp);
|
||||||
srvs.add(ScanQueryTestHelper.generateScanResultValue(timestamp, resultFormat, 1));
|
srvs.add(ScanQueryTestHelper.generateScanResultValue(timestamp, resultFormat, 1));
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class ScanQueryRunnerFactoryTest
|
||||||
// check total # of rows <= limit
|
// check total # of rows <= limit
|
||||||
Assert.assertTrue(output.size() <= query.getLimit());
|
Assert.assertTrue(output.size() <= query.getLimit());
|
||||||
|
|
||||||
// check ordering and values are correct
|
// check ordering is correct
|
||||||
for (int i = 1; i < output.size(); i++) {
|
for (int i = 1; i < output.size(); i++) {
|
||||||
if (query.getTimeOrder().equals(ScanQuery.TimeOrder.DESCENDING)) {
|
if (query.getTimeOrder().equals(ScanQuery.TimeOrder.DESCENDING)) {
|
||||||
Assert.assertTrue(output.get(i).getFirstEventTimestamp(resultFormat) <
|
Assert.assertTrue(output.get(i).getFirstEventTimestamp(resultFormat) <
|
||||||
|
@ -146,5 +146,10 @@ public class ScanQueryRunnerFactoryTest
|
||||||
output.get(i - 1).getFirstEventTimestamp(resultFormat));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue