a2l007 commented on a change in pull request #6505: Add default comparison to
HavingSpecMetricComparator for custom Aggregator types
URL: https://github.com/apache/incubator-druid/pull/6505#discussion_r238695112
##########
File path:
processing/src/test/java/org/apache/druid/query/groupby/GroupByQueryRunnerTest.java
##########
@@ -3815,6 +3816,112 @@ public void testMergedPostAggHavingSpec()
);
}
+ @Test
+ public void testCustomAggregatorHavingSpec()
+ {
+ List<Row> expectedResults = Arrays.asList(
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-01",
+ "alias",
+ "automotive",
+ "rows",
+ 1L,
+ "idxDouble",
+ 135.885094d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-01",
+ "alias",
+ "entertainment",
+ "rows",
+ 1L,
+ "idxDouble",
+ 158.747224d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-01",
+ "alias",
+ "mezzanine",
+ "rows",
+ 3L,
+ "idxDouble",
+ 2871.8866900000003d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-01",
+ "alias",
+ "premium",
+ "rows",
+ 3L,
+ "idxDouble",
+ 2900.798647d
+ ),
+
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-02",
+ "alias",
+ "automotive",
+ "rows",
+ 1L,
+ "idxDouble",
+ 147.425935d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-02",
+ "alias",
+ "entertainment",
+ "rows",
+ 1L,
+ "idxDouble",
+ 166.016049d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-02",
+ "alias",
+ "mezzanine",
+ "rows",
+ 3L,
+ "idxDouble",
+ 2448.830613d
+ ),
+ GroupByQueryRunnerTestHelper.createExpectedRow(
+ "2011-04-02",
+ "alias",
+ "premium",
+ "rows",
+ 3L,
+ "idxDouble",
+ 2506.415148d
+ )
+ );
+
+ GroupByQuery query = GroupByQuery
+ .builder()
+ .setDataSource(QueryRunnerTestHelper.dataSource)
+ .setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird)
+ .setDimensions(new DefaultDimensionSpec("quality", "alias"))
+ .setAggregatorSpecs(
+ QueryRunnerTestHelper.rowsCount,
+ new TestBigDecimalSumAggregatorFactory("idxDouble", "index")
+ )
+ .setGranularity(QueryRunnerTestHelper.dayGran)
+ .setHavingSpec(
+ new OrHavingSpec(
+ ImmutableList.of(
+ new EqualToHavingSpec("rows", 3L),
+ new GreaterThanHavingSpec("idxDouble", 135.00d)
+ )
+ )
+ )
+ .build();
+
+ TestHelper.assertExpectedObjects(
+ expectedResults,
+ GroupByQueryRunnerTestHelper.runQuery(factory, runner, query),
+ ""
Review comment:
Most of the tests in this class do not have a fail message. Maybe I can open
a separate PR to fix all the fail messages. Would that work?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]