kfaraz commented on code in PR #13151:
URL: https://github.com/apache/druid/pull/13151#discussion_r982268975
##########
sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java:
##########
@@ -998,6 +998,56 @@ public void testStringLatestGroupBy()
);
}
+ @Test
+ public void testStringLatestGroupByWithAlwaysFalseCondition()
+ {
+ testQuery(
+ "SELECT LATEST(dim4, 10),dim2 FROM numfoo WHERE (dim1 = 'something'
AND dim1 IN( 'something else') ) GROUP BY dim2",
+ ImmutableList.of(
+ Druids.newScanQueryBuilder()
+ .dataSource(InlineDataSource.fromIterable(
+ ImmutableList.of(),
+ RowSignature.builder()
+ .add("EXPR$0", ColumnType.STRING)
+ .add("dim2", ColumnType.STRING)
+ .build()
+ ))
+ .intervals(querySegmentSpec(Filtration.eternity()))
+ .columns("EXPR$0", "dim2")
+ .context(QUERY_CONTEXT_DEFAULT)
+ .resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
+ .legacy(false)
+ .build()
+ ),
+ ImmutableList.of()
+ );
+ }
+
+ @Test
+ public void testStringLatestByGroupByWithAlwaysFalseCondition()
Review Comment:
Perhaps a `LATEST(dim4, "100")` but it's not essential, we can do it later.
##########
sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/EarliestLatestBySqlAggregator.java:
##########
@@ -122,12 +122,20 @@ public Aggregation toDruidAggregation(
);
break;
case 3:
+ int maxStringBytes;
+ try {
+ maxStringBytes = RexLiteral.intValue(rexNodes.get(2));
Review Comment:
Thanks for the clarification, I was looking at an older doc in the original
PR.
--
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]