mirror of https://github.com/apache/druid.git
Merge pull request #1096 from metamx/incremental-index-time-selector
fix `__time` column selector for incremental index
This commit is contained in:
commit
1ee4f7cc13
|
@ -411,8 +411,24 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
|
||||||
@Override
|
@Override
|
||||||
public ObjectColumnSelector makeObjectColumnSelector(String column)
|
public ObjectColumnSelector makeObjectColumnSelector(String column)
|
||||||
{
|
{
|
||||||
final Integer metricIndexInt = index.getMetricIndex(column);
|
if (column.equals(Column.TIME_COLUMN_NAME)) {
|
||||||
|
return new ObjectColumnSelector<Long>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Class classOfObject()
|
||||||
|
{
|
||||||
|
return Long.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long get()
|
||||||
|
{
|
||||||
|
return currEntry.getKey().getTimestamp();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
final Integer metricIndexInt = index.getMetricIndex(column);
|
||||||
if (metricIndexInt != null) {
|
if (metricIndexInt != null) {
|
||||||
final int metricIndex = metricIndexInt;
|
final int metricIndex = metricIndexInt;
|
||||||
|
|
||||||
|
|
|
@ -91,20 +91,32 @@ public class QueryRunnerTestHelper
|
||||||
public static String dependentPostAggMetric = "dependentPostAgg";
|
public static String dependentPostAggMetric = "dependentPostAgg";
|
||||||
public static final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
|
public static final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
|
||||||
public static final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index");
|
public static final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index");
|
||||||
|
public static final LongSumAggregatorFactory __timeLongSum = new LongSumAggregatorFactory("sumtime", "__time");
|
||||||
public static final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
|
public static final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
|
||||||
|
public static final String JS_COMBINE_A_PLUS_B = "function combine(a, b) { return a + b; }";
|
||||||
|
public static final String JS_RESET_0 = "function reset() { return 0; }";
|
||||||
public static final JavaScriptAggregatorFactory jsIndexSumIfPlacementishA = new JavaScriptAggregatorFactory(
|
public static final JavaScriptAggregatorFactory jsIndexSumIfPlacementishA = new JavaScriptAggregatorFactory(
|
||||||
"nindex",
|
"nindex",
|
||||||
Arrays.asList("placementish", "index"),
|
Arrays.asList("placementish", "index"),
|
||||||
"function aggregate(current, a, b) { if ((Array.isArray(a) && a.indexOf('a') > -1) || a === 'a') { return current + b; } else { return current; } }",
|
"function aggregate(current, a, b) { if ((Array.isArray(a) && a.indexOf('a') > -1) || a === 'a') { return current + b; } else { return current; } }",
|
||||||
"function reset() { return 0; }",
|
JS_RESET_0,
|
||||||
"function combine(a, b) { return a + b; }"
|
JS_COMBINE_A_PLUS_B
|
||||||
|
);
|
||||||
|
public static final JavaScriptAggregatorFactory jsCountIfTimeGreaterThan = new JavaScriptAggregatorFactory(
|
||||||
|
"ntimestamps",
|
||||||
|
Arrays.asList("__time"),
|
||||||
|
"function aggregate(current, t) { if (t > " +
|
||||||
|
new DateTime("2011-04-01T12:00:00Z").getMillis() +
|
||||||
|
") { return current + 1; } else { return current; } }",
|
||||||
|
JS_RESET_0,
|
||||||
|
JS_COMBINE_A_PLUS_B
|
||||||
);
|
);
|
||||||
public static final JavaScriptAggregatorFactory jsPlacementishCount = new JavaScriptAggregatorFactory(
|
public static final JavaScriptAggregatorFactory jsPlacementishCount = new JavaScriptAggregatorFactory(
|
||||||
"pishcount",
|
"pishcount",
|
||||||
Arrays.asList("placementish", "index"),
|
Arrays.asList("placementish", "index"),
|
||||||
"function aggregate(current, a) { if (Array.isArray(a)) { return current + a.length; } else if (typeof a === 'string') { return current + 1; } else { return current; } }",
|
"function aggregate(current, a) { if (Array.isArray(a)) { return current + a.length; } else if (typeof a === 'string') { return current + 1; } else { return current; } }",
|
||||||
"function reset() { return 0; }",
|
JS_RESET_0,
|
||||||
"function combine(a, b) { return a + b; }"
|
JS_COMBINE_A_PLUS_B
|
||||||
);
|
);
|
||||||
public static final HyperUniquesAggregatorFactory qualityUniques = new HyperUniquesAggregatorFactory(
|
public static final HyperUniquesAggregatorFactory qualityUniques = new HyperUniquesAggregatorFactory(
|
||||||
"uniques",
|
"uniques",
|
||||||
|
|
|
@ -2034,4 +2034,37 @@ public class GroupByQueryRunnerTest
|
||||||
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
|
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
|
||||||
TestHelper.assertExpectedObjects(expectedResults, results, "");
|
TestHelper.assertExpectedObjects(expectedResults, results, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGroupByWithTimeColumn()
|
||||||
|
{
|
||||||
|
GroupByQuery query = GroupByQuery
|
||||||
|
.builder()
|
||||||
|
.setDataSource(QueryRunnerTestHelper.dataSource)
|
||||||
|
.setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird)
|
||||||
|
.setAggregatorSpecs(
|
||||||
|
Arrays.asList(
|
||||||
|
QueryRunnerTestHelper.rowsCount,
|
||||||
|
QueryRunnerTestHelper.jsCountIfTimeGreaterThan,
|
||||||
|
QueryRunnerTestHelper.__timeLongSum
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.setGranularity(QueryRunnerTestHelper.allGran)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
List<Row> expectedResults = Arrays.asList(
|
||||||
|
GroupByQueryRunnerTestHelper.createExpectedRow(
|
||||||
|
"2011-04-01",
|
||||||
|
"rows",
|
||||||
|
26L,
|
||||||
|
"ntimestamps",
|
||||||
|
13.0,
|
||||||
|
"sumtime",
|
||||||
|
33843139200000L
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
|
||||||
|
TestHelper.assertExpectedObjects(expectedResults, results, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2017,4 +2017,44 @@ public class TimeseriesQueryRunnerTest
|
||||||
|
|
||||||
TestHelper.assertExpectedResults(expectedResults, actualResults);
|
TestHelper.assertExpectedResults(expectedResults, actualResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTimeseriesWithTimeColumn()
|
||||||
|
{
|
||||||
|
TimeseriesQuery query = Druids.newTimeseriesQueryBuilder()
|
||||||
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
.aggregators(
|
||||||
|
Arrays.asList(
|
||||||
|
QueryRunnerTestHelper.rowsCount,
|
||||||
|
QueryRunnerTestHelper.jsCountIfTimeGreaterThan,
|
||||||
|
QueryRunnerTestHelper.__timeLongSum
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
List<Result<TimeseriesResultValue>> expectedResults = Arrays.asList(
|
||||||
|
new Result<>(
|
||||||
|
new DateTime("2011-04-01"),
|
||||||
|
new TimeseriesResultValue(
|
||||||
|
ImmutableMap.<String, Object>of(
|
||||||
|
"rows",
|
||||||
|
26L,
|
||||||
|
"ntimestamps",
|
||||||
|
13.0,
|
||||||
|
"sumtime",
|
||||||
|
33843139200000L
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Iterable<Result<TimeseriesResultValue>> actualResults = Sequences.toList(
|
||||||
|
runner.run(query, CONTEXT),
|
||||||
|
Lists.<Result<TimeseriesResultValue>>newArrayList()
|
||||||
|
);
|
||||||
|
|
||||||
|
TestHelper.assertExpectedResults(expectedResults, actualResults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ import io.druid.query.extraction.RegexDimExtractionFn;
|
||||||
import io.druid.query.filter.AndDimFilter;
|
import io.druid.query.filter.AndDimFilter;
|
||||||
import io.druid.query.filter.DimFilter;
|
import io.druid.query.filter.DimFilter;
|
||||||
import io.druid.query.spec.MultipleIntervalSegmentSpec;
|
import io.druid.query.spec.MultipleIntervalSegmentSpec;
|
||||||
|
import io.druid.query.timeseries.TimeseriesQuery;
|
||||||
|
import io.druid.query.timeseries.TimeseriesResultValue;
|
||||||
import io.druid.segment.TestHelper;
|
import io.druid.segment.TestHelper;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
|
@ -112,7 +114,6 @@ public class TopNQueryRunnerTest
|
||||||
this.runner = runner;
|
this.runner = runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String marketDimension = "market";
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFullOnTopN()
|
public void testFullOnTopN()
|
||||||
|
@ -120,7 +121,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||||
|
@ -144,7 +145,7 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "total_market")
|
.put(QueryRunnerTestHelper.marketDimension, "total_market")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 215679.82879638672D)
|
.put("index", 215679.82879638672D)
|
||||||
.put("addRowsIndexConstant", 215866.82879638672D)
|
.put("addRowsIndexConstant", 215866.82879638672D)
|
||||||
|
@ -153,7 +154,7 @@ public class TopNQueryRunnerTest
|
||||||
.put("minIndex", 792.3260498046875D)
|
.put("minIndex", 792.3260498046875D)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "upfront")
|
.put(QueryRunnerTestHelper.marketDimension, "upfront")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 192046.1060180664D)
|
.put("index", 192046.1060180664D)
|
||||||
.put("addRowsIndexConstant", 192233.1060180664D)
|
.put("addRowsIndexConstant", 192233.1060180664D)
|
||||||
|
@ -162,7 +163,7 @@ public class TopNQueryRunnerTest
|
||||||
.put("minIndex", 545.9906005859375D)
|
.put("minIndex", 545.9906005859375D)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "spot")
|
.put(QueryRunnerTestHelper.marketDimension, "spot")
|
||||||
.put("rows", 837L)
|
.put("rows", 837L)
|
||||||
.put("index", 95606.57232284546D)
|
.put("index", 95606.57232284546D)
|
||||||
.put("addRowsIndexConstant", 96444.57232284546D)
|
.put("addRowsIndexConstant", 96444.57232284546D)
|
||||||
|
@ -184,7 +185,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.addRowsIndexConstantMetric)
|
.metric(QueryRunnerTestHelper.addRowsIndexConstantMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||||
|
@ -208,7 +209,7 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "total_market")
|
.put(QueryRunnerTestHelper.marketDimension, "total_market")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 215679.82879638672D)
|
.put("index", 215679.82879638672D)
|
||||||
.put("addRowsIndexConstant", 215866.82879638672D)
|
.put("addRowsIndexConstant", 215866.82879638672D)
|
||||||
|
@ -217,7 +218,7 @@ public class TopNQueryRunnerTest
|
||||||
.put("minIndex", 792.3260498046875D)
|
.put("minIndex", 792.3260498046875D)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "upfront")
|
.put(QueryRunnerTestHelper.marketDimension, "upfront")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 192046.1060180664D)
|
.put("index", 192046.1060180664D)
|
||||||
.put("addRowsIndexConstant", 192233.1060180664D)
|
.put("addRowsIndexConstant", 192233.1060180664D)
|
||||||
|
@ -226,7 +227,7 @@ public class TopNQueryRunnerTest
|
||||||
.put("minIndex", 545.9906005859375D)
|
.put("minIndex", 545.9906005859375D)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "spot")
|
.put(QueryRunnerTestHelper.marketDimension, "spot")
|
||||||
.put("rows", 837L)
|
.put("rows", 837L)
|
||||||
.put("index", 95606.57232284546D)
|
.put("index", 95606.57232284546D)
|
||||||
.put("addRowsIndexConstant", 96444.57232284546D)
|
.put("addRowsIndexConstant", 96444.57232284546D)
|
||||||
|
@ -249,7 +250,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.uniqueMetric)
|
.metric(QueryRunnerTestHelper.uniqueMetric)
|
||||||
.threshold(3)
|
.threshold(3)
|
||||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||||
|
@ -313,7 +314,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.uniqueMetric)
|
.metric(QueryRunnerTestHelper.uniqueMetric)
|
||||||
.threshold(3)
|
.threshold(3)
|
||||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||||
|
@ -357,7 +358,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -375,21 +376,21 @@ public class TopNQueryRunnerTest
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2,
|
"uniques", QueryRunnerTestHelper.UNIQUES_2,
|
||||||
"rows", 4L
|
"rows", 4L
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2,
|
"uniques", QueryRunnerTestHelper.UNIQUES_2,
|
||||||
"rows", 4L
|
"rows", 4L
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9,
|
"uniques", QueryRunnerTestHelper.UNIQUES_9,
|
||||||
"rows", 18L
|
"rows", 18L
|
||||||
)
|
)
|
||||||
|
@ -432,7 +433,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -447,21 +448,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
|
@ -481,7 +482,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new NumericTopNMetricSpec("uniques"))
|
.metric(new NumericTopNMetricSpec("uniques"))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -530,8 +531,8 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(marketDimension, "total_market", "upfront", "spot")
|
.filters(QueryRunnerTestHelper.marketDimension, "total_market", "upfront", "spot")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -545,21 +546,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
|
@ -579,8 +580,8 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(marketDimension, "total_market", "upfront")
|
.filters(QueryRunnerTestHelper.marketDimension, "total_market", "upfront")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -594,14 +595,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -621,8 +622,8 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(marketDimension, "upfront")
|
.filters(QueryRunnerTestHelper.marketDimension, "upfront")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -636,7 +637,7 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -657,7 +658,7 @@ public class TopNQueryRunnerTest
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -671,21 +672,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 2L,
|
"rows", 2L,
|
||||||
"index", 2591.68359375D,
|
"index", 2591.68359375D,
|
||||||
"addRowsIndexConstant", 2594.68359375D,
|
"addRowsIndexConstant", 2594.68359375D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 2L,
|
"rows", 2L,
|
||||||
"index", 2508.39599609375D,
|
"index", 2508.39599609375D,
|
||||||
"addRowsIndexConstant", 2511.39599609375D,
|
"addRowsIndexConstant", 2511.39599609375D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 2L,
|
"rows", 2L,
|
||||||
"index", 220.63774871826172D,
|
"index", 220.63774871826172D,
|
||||||
"addRowsIndexConstant", 223.63774871826172D,
|
"addRowsIndexConstant", 223.63774871826172D,
|
||||||
|
@ -706,7 +707,7 @@ public class TopNQueryRunnerTest
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(
|
.intervals(
|
||||||
|
@ -724,21 +725,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 1L,
|
"rows", 1L,
|
||||||
"index", new Float(1447.341160).doubleValue(),
|
"index", new Float(1447.341160).doubleValue(),
|
||||||
"addRowsIndexConstant", new Float(1449.341160).doubleValue(),
|
"addRowsIndexConstant", new Float(1449.341160).doubleValue(),
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 1L,
|
"rows", 1L,
|
||||||
"index", new Float(1314.839715).doubleValue(),
|
"index", new Float(1314.839715).doubleValue(),
|
||||||
"addRowsIndexConstant", new Float(1316.839715).doubleValue(),
|
"addRowsIndexConstant", new Float(1316.839715).doubleValue(),
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
"uniques", QueryRunnerTestHelper.UNIQUES_1
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 1L,
|
"rows", 1L,
|
||||||
"index", new Float(109.705815).doubleValue(),
|
"index", new Float(109.705815).doubleValue(),
|
||||||
"addRowsIndexConstant", new Float(111.705815).doubleValue(),
|
"addRowsIndexConstant", new Float(111.705815).doubleValue(),
|
||||||
|
@ -758,8 +759,8 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(marketDimension, "total_market", "upfront", "billyblank")
|
.filters(QueryRunnerTestHelper.marketDimension, "total_market", "upfront", "billyblank")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -773,14 +774,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -800,8 +801,8 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(marketDimension, "billyblank")
|
.filters(QueryRunnerTestHelper.marketDimension, "billyblank")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -827,7 +828,7 @@ public class TopNQueryRunnerTest
|
||||||
.fields(
|
.fields(
|
||||||
Lists.<DimFilter>newArrayList(
|
Lists.<DimFilter>newArrayList(
|
||||||
Druids.newSelectorDimFilterBuilder()
|
Druids.newSelectorDimFilterBuilder()
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.value("billyblank")
|
.value("billyblank")
|
||||||
.build(),
|
.build(),
|
||||||
Druids.newSelectorDimFilterBuilder()
|
Druids.newSelectorDimFilterBuilder()
|
||||||
|
@ -840,7 +841,7 @@ public class TopNQueryRunnerTest
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(andDimFilter)
|
.filters(andDimFilter)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -866,7 +867,7 @@ public class TopNQueryRunnerTest
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(QueryRunnerTestHelper.placementishDimension, "m")
|
.filters(QueryRunnerTestHelper.placementishDimension, "m")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -881,7 +882,7 @@ public class TopNQueryRunnerTest
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
.filters(QueryRunnerTestHelper.qualityDimension, "mezzanine")
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.indexMetric)
|
.metric(QueryRunnerTestHelper.indexMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1187,7 +1188,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new LexicographicTopNMetricSpec(""))
|
.metric(new LexicographicTopNMetricSpec(""))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1201,21 +1202,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1235,7 +1236,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new LexicographicTopNMetricSpec("spot"))
|
.metric(new LexicographicTopNMetricSpec("spot"))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1249,14 +1250,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1276,7 +1277,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new LexicographicTopNMetricSpec("t"))
|
.metric(new LexicographicTopNMetricSpec("t"))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1290,14 +1291,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1317,7 +1318,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("upfront")))
|
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("upfront")))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1331,14 +1332,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
|
@ -1358,7 +1359,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("u")))
|
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("u")))
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1372,14 +1373,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
|
@ -1401,7 +1402,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric("rows")
|
.metric("rows")
|
||||||
|
@ -1417,21 +1418,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "s",
|
QueryRunnerTestHelper.marketDimension, "s",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "t",
|
QueryRunnerTestHelper.marketDimension, "t",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "u",
|
QueryRunnerTestHelper.marketDimension, "u",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1453,7 +1454,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric(new LexicographicTopNMetricSpec(null))
|
.metric(new LexicographicTopNMetricSpec(null))
|
||||||
|
@ -1469,21 +1470,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "s",
|
QueryRunnerTestHelper.marketDimension, "s",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "t",
|
QueryRunnerTestHelper.marketDimension, "t",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "u",
|
QueryRunnerTestHelper.marketDimension, "u",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1505,7 +1506,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("..(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("..(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec(null)))
|
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec(null)))
|
||||||
|
@ -1521,21 +1522,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "t",
|
QueryRunnerTestHelper.marketDimension, "t",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "o",
|
QueryRunnerTestHelper.marketDimension, "o",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "f",
|
QueryRunnerTestHelper.marketDimension, "f",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1557,7 +1558,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric(new LexicographicTopNMetricSpec("spot"))
|
.metric(new LexicographicTopNMetricSpec("spot"))
|
||||||
|
@ -1573,14 +1574,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "t",
|
QueryRunnerTestHelper.marketDimension, "t",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "u",
|
QueryRunnerTestHelper.marketDimension, "u",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1603,7 +1604,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("u")))
|
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("u")))
|
||||||
|
@ -1619,14 +1620,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "t",
|
QueryRunnerTestHelper.marketDimension, "t",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "s",
|
QueryRunnerTestHelper.marketDimension, "s",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
|
@ -1648,7 +1649,7 @@ public class TopNQueryRunnerTest
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(
|
new ExtractionDimensionSpec(
|
||||||
marketDimension, marketDimension, new RegexDimExtractionFn("..(.)")
|
QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, new RegexDimExtractionFn("..(.)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("p")))
|
.metric(new InvertedTopNMetricSpec(new LexicographicTopNMetricSpec("p")))
|
||||||
|
@ -1664,14 +1665,14 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "o",
|
QueryRunnerTestHelper.marketDimension, "o",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "f",
|
QueryRunnerTestHelper.marketDimension, "f",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1717,7 +1718,7 @@ public class TopNQueryRunnerTest
|
||||||
.aggregators(QueryRunnerTestHelper.commonAggregators)
|
.aggregators(QueryRunnerTestHelper.commonAggregators)
|
||||||
.postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant))
|
.postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant))
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(marketDimension, marketDimension, nullStringDimExtraction)
|
new ExtractionDimensionSpec(QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, nullStringDimExtraction)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -1728,21 +1729,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
new LinkedHashMap<String, Object>(){{
|
new LinkedHashMap<String, Object>(){{
|
||||||
put(marketDimension, null);
|
put(QueryRunnerTestHelper.marketDimension, null);
|
||||||
put("rows", 4L);
|
put("rows", 4L);
|
||||||
put("index", 5351.814697265625D);
|
put("index", 5351.814697265625D);
|
||||||
put("addRowsIndexConstant", 5356.814697265625D);
|
put("addRowsIndexConstant", 5356.814697265625D);
|
||||||
put("uniques", QueryRunnerTestHelper.UNIQUES_2);
|
put("uniques", QueryRunnerTestHelper.UNIQUES_2);
|
||||||
}},
|
}},
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1795,7 +1796,7 @@ public class TopNQueryRunnerTest
|
||||||
.aggregators(QueryRunnerTestHelper.commonAggregators)
|
.aggregators(QueryRunnerTestHelper.commonAggregators)
|
||||||
.postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant))
|
.postAggregators(Arrays.<PostAggregator>asList(QueryRunnerTestHelper.addRowsIndexConstant))
|
||||||
.dimension(
|
.dimension(
|
||||||
new ExtractionDimensionSpec(marketDimension, marketDimension, emptyStringDimExtraction))
|
new ExtractionDimensionSpec(QueryRunnerTestHelper.marketDimension, QueryRunnerTestHelper.marketDimension, emptyStringDimExtraction))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1805,21 +1806,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
new LinkedHashMap<String, Object>(){{
|
new LinkedHashMap<String, Object>(){{
|
||||||
put(marketDimension, "");
|
put(QueryRunnerTestHelper.marketDimension, "");
|
||||||
put("rows", 4L);
|
put("rows", 4L);
|
||||||
put("index", 5351.814697265625D);
|
put("index", 5351.814697265625D);
|
||||||
put("addRowsIndexConstant", 5356.814697265625D);
|
put("addRowsIndexConstant", 5356.814697265625D);
|
||||||
put("uniques", QueryRunnerTestHelper.UNIQUES_2);
|
put("uniques", QueryRunnerTestHelper.UNIQUES_2);
|
||||||
}},
|
}},
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
|
@ -1840,7 +1841,7 @@ public class TopNQueryRunnerTest
|
||||||
new TopNQueryBuilder()
|
new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec(QueryRunnerTestHelper.indexMetric)))
|
.metric(new InvertedTopNMetricSpec(new NumericTopNMetricSpec(QueryRunnerTestHelper.indexMetric)))
|
||||||
.threshold(3)
|
.threshold(3)
|
||||||
.intervals(QueryRunnerTestHelper.firstToThird)
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
@ -1854,21 +1855,21 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "spot",
|
QueryRunnerTestHelper.marketDimension, "spot",
|
||||||
"rows", 18L,
|
"rows", 18L,
|
||||||
"index", 2231.8768157958984D,
|
"index", 2231.8768157958984D,
|
||||||
"addRowsIndexConstant", 2250.8768157958984D,
|
"addRowsIndexConstant", 2250.8768157958984D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
"uniques", QueryRunnerTestHelper.UNIQUES_9
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "upfront",
|
QueryRunnerTestHelper.marketDimension, "upfront",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 4875.669677734375D,
|
"index", 4875.669677734375D,
|
||||||
"addRowsIndexConstant", 4880.669677734375D,
|
"addRowsIndexConstant", 4880.669677734375D,
|
||||||
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
"uniques", QueryRunnerTestHelper.UNIQUES_2
|
||||||
),
|
),
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
marketDimension, "total_market",
|
QueryRunnerTestHelper.marketDimension, "total_market",
|
||||||
"rows", 4L,
|
"rows", 4L,
|
||||||
"index", 5351.814697265625D,
|
"index", 5351.814697265625D,
|
||||||
"addRowsIndexConstant", 5356.814697265625D,
|
"addRowsIndexConstant", 5356.814697265625D,
|
||||||
|
@ -1933,7 +1934,7 @@ public class TopNQueryRunnerTest
|
||||||
TopNQuery query = new TopNQueryBuilder()
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
.dataSource(QueryRunnerTestHelper.dataSource)
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
.granularity(QueryRunnerTestHelper.allGran)
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
.dimension(marketDimension)
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
.metric(QueryRunnerTestHelper.dependentPostAggMetric)
|
.metric(QueryRunnerTestHelper.dependentPostAggMetric)
|
||||||
.threshold(4)
|
.threshold(4)
|
||||||
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
.intervals(QueryRunnerTestHelper.fullOnInterval)
|
||||||
|
@ -1963,7 +1964,7 @@ public class TopNQueryRunnerTest
|
||||||
new TopNResultValue(
|
new TopNResultValue(
|
||||||
Arrays.<Map<String, Object>>asList(
|
Arrays.<Map<String, Object>>asList(
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "total_market")
|
.put(QueryRunnerTestHelper.marketDimension, "total_market")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 215679.82879638672D)
|
.put("index", 215679.82879638672D)
|
||||||
.put("addRowsIndexConstant", 215866.82879638672D)
|
.put("addRowsIndexConstant", 215866.82879638672D)
|
||||||
|
@ -1977,7 +1978,7 @@ public class TopNQueryRunnerTest
|
||||||
)
|
)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "upfront")
|
.put(QueryRunnerTestHelper.marketDimension, "upfront")
|
||||||
.put("rows", 186L)
|
.put("rows", 186L)
|
||||||
.put("index", 192046.1060180664D)
|
.put("index", 192046.1060180664D)
|
||||||
.put("addRowsIndexConstant", 192233.1060180664D)
|
.put("addRowsIndexConstant", 192233.1060180664D)
|
||||||
|
@ -1991,7 +1992,7 @@ public class TopNQueryRunnerTest
|
||||||
)
|
)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<String, Object>builder()
|
ImmutableMap.<String, Object>builder()
|
||||||
.put(marketDimension, "spot")
|
.put(QueryRunnerTestHelper.marketDimension, "spot")
|
||||||
.put("rows", 837L)
|
.put("rows", 837L)
|
||||||
.put("index", 95606.57232284546D)
|
.put("index", 95606.57232284546D)
|
||||||
.put("addRowsIndexConstant", 96444.57232284546D)
|
.put("addRowsIndexConstant", 96444.57232284546D)
|
||||||
|
@ -2094,4 +2095,63 @@ public class TopNQueryRunnerTest
|
||||||
HashMap<String, Object> context = new HashMap<String, Object>();
|
HashMap<String, Object> context = new HashMap<String, Object>();
|
||||||
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
|
TestHelper.assertExpectedResults(expectedResults, runner.run(query, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTopNWithTimeColumn()
|
||||||
|
{
|
||||||
|
TopNQuery query = new TopNQueryBuilder()
|
||||||
|
.dataSource(QueryRunnerTestHelper.dataSource)
|
||||||
|
.intervals(QueryRunnerTestHelper.firstToThird)
|
||||||
|
.aggregators(
|
||||||
|
Arrays.asList(
|
||||||
|
QueryRunnerTestHelper.rowsCount,
|
||||||
|
QueryRunnerTestHelper.jsCountIfTimeGreaterThan,
|
||||||
|
QueryRunnerTestHelper.__timeLongSum
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.granularity(QueryRunnerTestHelper.allGran)
|
||||||
|
.dimension(QueryRunnerTestHelper.marketDimension)
|
||||||
|
.metric("ntimestamps")
|
||||||
|
.threshold(3)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
List<Result<TopNResultValue>> expectedResults = Arrays.asList(
|
||||||
|
new Result<>(
|
||||||
|
new DateTime("2011-04-01"),
|
||||||
|
new TopNResultValue(
|
||||||
|
Arrays.<Map<String, Object>>asList(
|
||||||
|
ImmutableMap.<String, Object>of(
|
||||||
|
"market", "spot",
|
||||||
|
"rows",
|
||||||
|
18L,
|
||||||
|
"ntimestamps",
|
||||||
|
9.0,
|
||||||
|
"sumtime",
|
||||||
|
23429865600000L
|
||||||
|
),
|
||||||
|
ImmutableMap.<String, Object>of(
|
||||||
|
"market", "total_market",
|
||||||
|
"rows",
|
||||||
|
4L,
|
||||||
|
"ntimestamps",
|
||||||
|
2.0,
|
||||||
|
"sumtime",
|
||||||
|
5206636800000L
|
||||||
|
),
|
||||||
|
ImmutableMap.<String, Object>of(
|
||||||
|
"market", "upfront",
|
||||||
|
"rows",
|
||||||
|
4L,
|
||||||
|
"ntimestamps",
|
||||||
|
2.0,
|
||||||
|
"sumtime",
|
||||||
|
5206636800000L
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
TestHelper.assertExpectedResults(expectedResults, runner.run(query, Maps.newHashMap()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue