jihoonson 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_r238839008
##
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 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.886690003d
+),
+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:
It's fine for me too. @asdf2014 what do you think?
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:
us...@infra.apache.org
With regards,
Apache Git Services
-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org