Skip to content

Commit

Permalink
Add groupBy test for multiple multi-value dimensions. (apache#3415)
Browse files Browse the repository at this point in the history
  • Loading branch information
gianm authored and fjy committed Aug 31, 2016
1 parent e9050c2 commit 1268e29
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,40 @@ public void testMultiValueDimension()
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
public void testMultipleDimensionsOneOfWhichIsMultiValue1()
{
Expand Down

0 comments on commit 1268e29

Please sign in to comment.