Add groupBy test for multiple multi-value dimensions. (#3415)

This commit is contained in:
Gian Merlino 2016-08-31 11:21:10 -07:00 committed by Fangjin Yang
parent e9050c2b4c
commit 1268e2902c
1 changed files with 34 additions and 0 deletions

View File

@ -445,6 +445,40 @@ public class GroupByQueryRunnerTest
TestHelper.assertExpectedObjects(expectedResults, results, ""); TestHelper.assertExpectedObjects(expectedResults, results, "");
} }
@Test
public void testTwoMultiValueDimensions()
{
GroupByQuery query = GroupByQuery
.builder()
.setDataSource(QueryRunnerTestHelper.dataSource)
.setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird)
.setDimFilter(new SelectorDimFilter("placementish", "a", null))
.setDimensions(
Lists.<DimensionSpec>newArrayList(
new DefaultDimensionSpec("placementish", "alias"),
new DefaultDimensionSpec("placementish", "alias2")
)
)
.setAggregatorSpecs(
Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
)
)
.setGranularity(QueryRunnerTestHelper.allGran)
.build();
List<Row> expectedResults = Arrays.asList(
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "a", "alias2", "a", "rows", 2L, "idx", 282L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "a", "alias2", "preferred", "rows", 2L, "idx", 282L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "preferred", "alias2", "a", "rows", 2L, "idx", 282L),
GroupByQueryRunnerTestHelper.createExpectedRow("2011-04-01", "alias", "preferred", "alias2", "preferred", "rows", 2L, "idx", 282L)
);
Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query);
TestHelper.assertExpectedObjects(expectedResults, results, "");
}
@Test @Test
public void testMultipleDimensionsOneOfWhichIsMultiValue1() public void testMultipleDimensionsOneOfWhichIsMultiValue1()
{ {