somu-imply commented on code in PR #12439:
URL: https://github.com/apache/druid/pull/12439#discussion_r852454651
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java:
##########
@@ -648,6 +648,42 @@ public void testEarliestAggregators() throws Exception
);
}
+ @Test
+ public void testLatestVectorAggregators() throws Exception
+ {
+ // Cannot vectorize LATEST aggregator.
+ //skipVectorize();
+
+ testQuery(
+ "SELECT "
+ + "LATEST(cnt), LATEST(cnt + 1), LATEST(m1), LATEST(m1+1) "
+ + "FROM druid.numfoo",
+ ImmutableList.of(
+ Druids.newTimeseriesQueryBuilder()
+ .dataSource(CalciteTests.DATASOURCE3)
+ .intervals(querySegmentSpec(Filtration.eternity()))
+ .granularity(Granularities.ALL)
+ .virtualColumns(
+ expressionVirtualColumn("v0", "(\"cnt\" + 1)",
ColumnType.LONG),
+ expressionVirtualColumn("v1", "(\"m1\" + 1)",
ColumnType.FLOAT)
+ )
+ .aggregators(
+ aggregators(
+ new LongLastAggregatorFactory("a0", "cnt", null),
+ new LongLastAggregatorFactory("a1", "v0", null),
+ new FloatLastAggregatorFactory("a2", "m1", null),
+ new FloatLastAggregatorFactory("a3", "v1", null)
+ )
+ )
+ .context(QUERY_CONTEXT_DEFAULT)
+ .build()
+ ),
+ ImmutableList.of(
+ new Object[]{1L, 2L, 6.0f, 7.0f}
+ )
+ );
+ }
+
Review Comment:
I'll add these once the string aggregator is done as in some of the cases a
StringLastAggregator is also used
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]