fix up some comments for contributed test

This commit is contained in:
fjy 2015-04-16 15:07:09 -07:00
parent 90b17a5259
commit f0a19349bf
1 changed files with 693 additions and 122 deletions

View File

@ -82,6 +82,7 @@ import org.joda.time.Interval;
import org.joda.time.Period;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -89,7 +90,12 @@ import org.junit.runners.Parameterized;
import javax.annotation.Nullable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -131,8 +137,10 @@ public class GroupByQueryRunnerTest
engine,
QueryRunnerTestHelper.NOOP_QUERYWATCHER,
configSupplier,
new GroupByQueryQueryToolChest(configSupplier, mapper, engine, TestQueryRunners.pool,
QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()),
new GroupByQueryQueryToolChest(
configSupplier, mapper, engine, TestQueryRunners.pool,
QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()
),
TestQueryRunners.pool
);
@ -153,8 +161,10 @@ public class GroupByQueryRunnerTest
singleThreadEngine,
QueryRunnerTestHelper.NOOP_QUERYWATCHER,
singleThreadedConfigSupplier,
new GroupByQueryQueryToolChest(singleThreadedConfigSupplier, mapper, singleThreadEngine, pool,
QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()),
new GroupByQueryQueryToolChest(
singleThreadedConfigSupplier, mapper, singleThreadEngine, pool,
QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()
),
pool
);
@ -358,14 +368,18 @@ public class GroupByQueryRunnerTest
.builder()
.setDataSource(QueryRunnerTestHelper.dataSource)
.setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird)
.setAggregatorSpecs(Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
))
.setAggregatorSpecs(
Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
.setDimensions(Lists.<DimensionSpec>newArrayList(
.setDimensions(
Lists.<DimensionSpec>newArrayList(
new ExtractionDimensionSpec("quality", "alias", nullExtractionFn, null)
))
)
)
.build();
List<Row> expectedResults = Arrays.asList(
@ -388,7 +402,11 @@ public class GroupByQueryRunnerTest
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "t", "rows", 2L, "idx", 223L)
);
TestHelper.assertExpectedObjects(expectedResults, GroupByQueryRunnerTestHelper.runQuery(factory, runner, query), "");
TestHelper.assertExpectedObjects(
expectedResults,
GroupByQueryRunnerTestHelper.runQuery(factory, runner, query),
""
);
}
@Test
@ -425,14 +443,18 @@ public class GroupByQueryRunnerTest
.builder()
.setDataSource(QueryRunnerTestHelper.dataSource)
.setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird)
.setAggregatorSpecs(Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
))
.setAggregatorSpecs(
Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
.setDimensions(Lists.<DimensionSpec>newArrayList(
new ExtractionDimensionSpec("quality", "alias", emptyStringExtractionFn, null)
))
.setDimensions(
Lists.<DimensionSpec>newArrayList(
new ExtractionDimensionSpec("quality", "alias", emptyStringExtractionFn, null)
)
)
.build();
List<Row> expectedResults = Arrays.asList(
@ -455,7 +477,11 @@ public class GroupByQueryRunnerTest
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "t", "rows", 2L, "idx", 223L)
);
TestHelper.assertExpectedObjects(expectedResults, GroupByQueryRunnerTestHelper.runQuery(factory, runner, query), "");
TestHelper.assertExpectedObjects(
expectedResults,
GroupByQueryRunnerTestHelper.runQuery(factory, runner, query),
""
);
}
@Test
@ -1202,66 +1228,87 @@ public class GroupByQueryRunnerTest
TestHelper.assertExpectedObjects(expectedResults, results, "order-limit");
}
@Test
public void testGroupByWithOrderLimit5()
{
GroupByQuery query = new GroupByQuery.Builder()
.setDataSource(QueryRunnerTestHelper.dataSource)
.setGranularity(QueryRunnerTestHelper.dayGran)
.setDimensions(
Arrays.<DimensionSpec>asList(
new DefaultDimensionSpec(
QueryRunnerTestHelper.marketDimension,
QueryRunnerTestHelper.marketDimension
)
)
@Ignore
@Test
// This is a test to verify per limit groupings, but Druid currently does not support this functionality. At a point
// in time when Druid does support this, we can re-evaluate this test.
public void testLimitPerGrouping()
{
GroupByQuery query = new GroupByQuery.Builder()
.setDataSource(QueryRunnerTestHelper.dataSource)
.setGranularity(QueryRunnerTestHelper.dayGran)
.setDimensions(
Arrays.<DimensionSpec>asList(
new DefaultDimensionSpec(
QueryRunnerTestHelper.marketDimension,
QueryRunnerTestHelper.marketDimension
)
.setInterval(QueryRunnerTestHelper.firstToThird)
.setLimitSpec(
new DefaultLimitSpec(
Lists.newArrayList(
new OrderByColumnSpec(
"rows",
OrderByColumnSpec.Direction.DESCENDING
)
), 2
)
)
.setAggregatorSpecs(
Lists.<AggregatorFactory>newArrayList(
QueryRunnerTestHelper.rowsCount
)
)
.build();
)
)
.setInterval(QueryRunnerTestHelper.firstToThird)
// Using a limitSpec here to achieve a per group limit is incorrect.
// Limit is applied on the overall results.
.setLimitSpec(
new DefaultLimitSpec(
Lists.newArrayList(
new OrderByColumnSpec(
"rows",
OrderByColumnSpec.Direction.DESCENDING
)
), 2
)
)
.setAggregatorSpecs(
Lists.<AggregatorFactory>newArrayList(
QueryRunnerTestHelper.rowsCount
)
)
.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01T00:00:00.000Z", "market", "spot", "rows", 9L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02T00:00:00.000Z", "market", "spot", "rows", 9L)
);
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01T00:00:00.000Z", "market", "spot", "rows", 9L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02T00:00:00.000Z", "market", "spot", "rows", 9L)
);
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
Iterator resultsIter = results.iterator();
Iterator expectedResultsIter = expectedResults.iterator();
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
Iterator resultsIter = results.iterator();
Iterator expectedResultsIter = expectedResults.iterator();
final Object next1 = resultsIter.next();
Object expectedNext1 = expectedResultsIter.next();
Assert.assertEquals("order-limit", expectedNext1, next1);
final Object next1 = resultsIter.next();
Object expectedNext1 = expectedResultsIter.next();
Assert.assertEquals("order-limit", expectedNext1, next1);
final Object next2 = resultsIter.next();
Object expectedNext2 = expectedResultsIter.next();
Assert.assertNotEquals("order-limit", expectedNext2, next2);
Row incorrectResultRow = GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01T00:00:00.000Z", "market", "upfront", "rows", 2L);
Assert.assertEquals("order-limit", incorrectResultRow, next2);
}
final Object next2 = resultsIter.next();
Object expectedNext2 = expectedResultsIter.next();
Assert.assertNotEquals("order-limit", expectedNext2, next2);
}
@Test
public void testPostAggMergedHavingSpec()
{
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "mezzanine", "rows", 6L, "index", 4420L, QueryRunnerTestHelper.addRowsIndexConstantMetric,(double) (6L+4420L+1L)),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "premium", "rows", 6L, "index", 4416L, QueryRunnerTestHelper.addRowsIndexConstantMetric, (double) (6L+4416L+1L))
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"mezzanine",
"rows",
6L,
"index",
4420L,
QueryRunnerTestHelper.addRowsIndexConstantMetric,
(double) (6L + 4420L + 1L)
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"premium",
"rows",
6L,
"index",
4416L,
QueryRunnerTestHelper.addRowsIndexConstantMetric,
(double) (6L + 4416L + 1L)
)
);
GroupByQuery.Builder builder = GroupByQuery
@ -1361,7 +1408,11 @@ public class GroupByQueryRunnerTest
);
final GroupByQuery fullQuery = builder.build();
TestHelper.assertExpectedObjects(expectedResults, GroupByQueryRunnerTestHelper.runQuery(factory, runner, fullQuery), "");
TestHelper.assertExpectedObjects(
expectedResults,
GroupByQueryRunnerTestHelper.runQuery(factory, runner, fullQuery),
""
);
}
@ -1396,7 +1447,11 @@ public class GroupByQueryRunnerTest
);
final GroupByQuery fullQuery = builder.build();
TestHelper.assertExpectedObjects(expectedResults, GroupByQueryRunnerTestHelper.runQuery(factory, runner, fullQuery), "");
TestHelper.assertExpectedObjects(
expectedResults,
GroupByQueryRunnerTestHelper.runQuery(factory, runner, fullQuery),
""
);
}
@Test
@ -1521,14 +1576,38 @@ public class GroupByQueryRunnerTest
final GroupByQuery query = builder.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "automotive", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"index",
null,
"quality",
"automotive",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "business", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "entertainment", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"index",
null,
"quality",
"entertainment",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "health", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "mezzanine", "rows", 6L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "news", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "premium", "rows", 6L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "technology", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"index",
null,
"quality",
"technology",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "index", null, "quality", "travel", "rows", 2L)
);
@ -1577,14 +1656,38 @@ public class GroupByQueryRunnerTest
final GroupByQuery query = builder.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "automotive", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"billy",
null,
"quality",
"automotive",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "business", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "entertainment", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"billy",
null,
"quality",
"entertainment",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "health", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "mezzanine", "rows", 6L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "news", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "premium", "rows", 6L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "technology", "rows", 2L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"billy",
null,
"quality",
"technology",
"rows",
2L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "billy", null, "quality", "travel", "rows", 2L)
);
@ -1837,8 +1940,28 @@ public class GroupByQueryRunnerTest
.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "automotive", "rows", 1L, "idx_post", 11135.0, "idx", 1135L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "business", "rows", 1L, "idx_post", 11118.0, "idx", 1118L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"automotive",
"rows",
1L,
"idx_post",
11135.0,
"idx",
1135L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"business",
"rows",
1L,
"idx_post",
11118.0,
"idx",
1118L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
@ -1850,15 +1973,95 @@ public class GroupByQueryRunnerTest
"idx",
1158L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "health", "rows", 1L, "idx_post", 11120.0, "idx", 1120L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "mezzanine", "rows", 3L, "idx_post", 13870.0, "idx", 3870L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "news", "rows", 1L, "idx_post", 11121.0, "idx", 1121L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "premium", "rows", 3L, "idx_post", 13900.0, "idx", 3900L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "technology", "rows", 1L, "idx_post", 11078.0, "idx", 1078L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "travel", "rows", 1L, "idx_post", 11119.0, "idx", 1119L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"health",
"rows",
1L,
"idx_post",
11120.0,
"idx",
1120L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"mezzanine",
"rows",
3L,
"idx_post",
13870.0,
"idx",
3870L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"news",
"rows",
1L,
"idx_post",
11121.0,
"idx",
1121L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"premium",
"rows",
3L,
"idx_post",
13900.0,
"idx",
3900L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"technology",
"rows",
1L,
"idx_post",
11078.0,
"idx",
1078L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"travel",
"rows",
1L,
"idx_post",
11119.0,
"idx",
1119L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "automotive", "rows", 1L, "idx_post", 11147.0, "idx", 1147L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "business", "rows", 1L, "idx_post", 11112.0, "idx", 1112L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"automotive",
"rows",
1L,
"idx_post",
11147.0,
"idx",
1147L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"business",
"rows",
1L,
"idx_post",
11112.0,
"idx",
1112L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
@ -1870,12 +2073,72 @@ public class GroupByQueryRunnerTest
"idx",
1166L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "health", "rows", 1L, "idx_post", 11113.0, "idx", 1113L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "mezzanine", "rows", 3L, "idx_post", 13447.0, "idx", 3447L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "news", "rows", 1L, "idx_post", 11114.0, "idx", 1114L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "premium", "rows", 3L, "idx_post", 13505.0, "idx", 3505L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "technology", "rows", 1L, "idx_post", 11097.0, "idx", 1097L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "travel", "rows", 1L, "idx_post", 11126.0, "idx", 1126L)
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"health",
"rows",
1L,
"idx_post",
11113.0,
"idx",
1113L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"mezzanine",
"rows",
3L,
"idx_post",
13447.0,
"idx",
3447L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"news",
"rows",
1L,
"idx_post",
11114.0,
"idx",
1114L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"premium",
"rows",
3L,
"idx_post",
13505.0,
"idx",
3505L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"technology",
"rows",
1L,
"idx_post",
11097.0,
"idx",
1097L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"travel",
"rows",
1L,
"idx_post",
11126.0,
"idx",
1126L
)
);
// Subqueries are handled by the ToolChest
@ -1957,8 +2220,28 @@ public class GroupByQueryRunnerTest
.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "automotive", "rows", 1L, "idx_post", 11135.0, "idx", 1135L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "business", "rows", 1L, "idx_post", 11118.0, "idx", 1118L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"automotive",
"rows",
1L,
"idx_post",
11135.0,
"idx",
1135L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"business",
"rows",
1L,
"idx_post",
11118.0,
"idx",
1118L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
@ -1970,13 +2253,73 @@ public class GroupByQueryRunnerTest
"idx",
1158L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "health", "rows", 1L, "idx_post", 11120.0, "idx", 1120L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "news", "rows", 1L, "idx_post", 11121.0, "idx", 1121L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "technology", "rows", 1L, "idx_post", 11078.0, "idx", 1078L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "travel", "rows", 1L, "idx_post", 11119.0, "idx", 1119L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"health",
"rows",
1L,
"idx_post",
11120.0,
"idx",
1120L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"news",
"rows",
1L,
"idx_post",
11121.0,
"idx",
1121L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"technology",
"rows",
1L,
"idx_post",
11078.0,
"idx",
1078L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-01",
"alias",
"travel",
"rows",
1L,
"idx_post",
11119.0,
"idx",
1119L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "automotive", "rows", 1L, "idx_post", 11147.0, "idx", 1147L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "business", "rows", 1L, "idx_post", 11112.0, "idx", 1112L),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"automotive",
"rows",
1L,
"idx_post",
11147.0,
"idx",
1147L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"business",
"rows",
1L,
"idx_post",
11112.0,
"idx",
1112L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
@ -1988,12 +2331,72 @@ public class GroupByQueryRunnerTest
"idx",
1166L
),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "health", "rows", 1L, "idx_post", 11113.0, "idx", 1113L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "mezzanine", "rows", 3L, "idx_post", 13447.0, "idx", 3447L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "news", "rows", 1L, "idx_post", 11114.0, "idx", 1114L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "premium", "rows", 3L, "idx_post", 13505.0, "idx", 3505L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "technology", "rows", 1L, "idx_post", 11097.0, "idx", 1097L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-02", "alias", "travel", "rows", 1L, "idx_post", 11126.0, "idx", 1126L)
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"health",
"rows",
1L,
"idx_post",
11113.0,
"idx",
1113L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"mezzanine",
"rows",
3L,
"idx_post",
13447.0,
"idx",
3447L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"news",
"rows",
1L,
"idx_post",
11114.0,
"idx",
1114L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"premium",
"rows",
3L,
"idx_post",
13505.0,
"idx",
3505L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"technology",
"rows",
1L,
"idx_post",
11097.0,
"idx",
1097L
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"2011-04-02",
"alias",
"travel",
"rows",
1L,
"idx_post",
11126.0,
"idx",
1126L
)
);
// Subqueries are handled by the ToolChest
@ -2376,20 +2779,188 @@ public class GroupByQueryRunnerTest
.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Friday", "market", "spot", "index", 13219.574157714844, "rows", 117L, "addRowsIndexConstant", 13337.574157714844),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Monday", "market", "spot", "index", 13557.738830566406, "rows", 117L, "addRowsIndexConstant", 13675.738830566406),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Saturday", "market", "spot", "index", 13493.751281738281, "rows", 117L, "addRowsIndexConstant", 13611.751281738281),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Sunday", "market", "spot", "index", 13585.541015625, "rows", 117L, "addRowsIndexConstant", 13703.541015625),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Thursday", "market", "spot", "index", 14279.127197265625, "rows", 126L, "addRowsIndexConstant", 14406.127197265625),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Tuesday", "market", "spot", "index", 13199.471435546875, "rows", 117L, "addRowsIndexConstant", 13317.471435546875),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Wednesday", "market", "spot", "index", 14271.368591308594, "rows", 126L, "addRowsIndexConstant", 14398.368591308594),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Friday", "market", "upfront", "index", 27297.8623046875, "rows", 26L, "addRowsIndexConstant", 27324.8623046875),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Monday", "market", "upfront", "index", 27619.58447265625, "rows", 26L, "addRowsIndexConstant", 27646.58447265625),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Saturday", "market", "upfront", "index", 27820.83154296875, "rows", 26L, "addRowsIndexConstant", 27847.83154296875),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Sunday", "market", "upfront", "index", 24791.223876953125, "rows", 26L, "addRowsIndexConstant", 24818.223876953125),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Thursday", "market", "upfront", "index", 28562.748901367188, "rows", 28L, "addRowsIndexConstant", 28591.748901367188),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Tuesday", "market", "upfront", "index", 26968.280639648438, "rows", 26L, "addRowsIndexConstant", 26995.280639648438),
GroupByQueryRunnerTestHelper.createExpectedRow("1970-01-01", "dayOfWeek", "Wednesday", "market", "upfront", "index", 28985.5751953125, "rows", 28L, "addRowsIndexConstant", 29014.5751953125)
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Friday",
"market",
"spot",
"index",
13219.574157714844,
"rows",
117L,
"addRowsIndexConstant",
13337.574157714844
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Monday",
"market",
"spot",
"index",
13557.738830566406,
"rows",
117L,
"addRowsIndexConstant",
13675.738830566406
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Saturday",
"market",
"spot",
"index",
13493.751281738281,
"rows",
117L,
"addRowsIndexConstant",
13611.751281738281
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Sunday",
"market",
"spot",
"index",
13585.541015625,
"rows",
117L,
"addRowsIndexConstant",
13703.541015625
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Thursday",
"market",
"spot",
"index",
14279.127197265625,
"rows",
126L,
"addRowsIndexConstant",
14406.127197265625
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Tuesday",
"market",
"spot",
"index",
13199.471435546875,
"rows",
117L,
"addRowsIndexConstant",
13317.471435546875
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Wednesday",
"market",
"spot",
"index",
14271.368591308594,
"rows",
126L,
"addRowsIndexConstant",
14398.368591308594
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Friday",
"market",
"upfront",
"index",
27297.8623046875,
"rows",
26L,
"addRowsIndexConstant",
27324.8623046875
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Monday",
"market",
"upfront",
"index",
27619.58447265625,
"rows",
26L,
"addRowsIndexConstant",
27646.58447265625
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Saturday",
"market",
"upfront",
"index",
27820.83154296875,
"rows",
26L,
"addRowsIndexConstant",
27847.83154296875
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Sunday",
"market",
"upfront",
"index",
24791.223876953125,
"rows",
26L,
"addRowsIndexConstant",
24818.223876953125
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Thursday",
"market",
"upfront",
"index",
28562.748901367188,
"rows",
28L,
"addRowsIndexConstant",
28591.748901367188
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Tuesday",
"market",
"upfront",
"index",
26968.280639648438,
"rows",
26L,
"addRowsIndexConstant",
26995.280639648438
),
GroupByQueryRunnerTestHelper.createExpectedRow(
"1970-01-01",
"dayOfWeek",
"Wednesday",
"market",
"upfront",
"index",
28985.5751953125,
"rows",
28L,
"addRowsIndexConstant",
29014.5751953125
)
);
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);