pranavbhole commented on code in PR #15434:
URL: https://github.com/apache/druid/pull/15434#discussion_r1408714401


##########
sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/EarliestLatestAnySqlAggregator.java:
##########
@@ -244,17 +249,35 @@ public Aggregation toDruidAggregation(
     final AggregatorFactory theAggFactory;
     switch (args.size()) {
       case 1:
-        theAggFactory = aggregatorType.createAggregatorFactory(aggregatorName, 
fieldName, null, outputType, null);
+        theAggFactory = aggregatorType.createAggregatorFactory(aggregatorName, 
fieldName, null, outputType, null, true);
         break;
       case 2:
-        int maxStringBytes;
+        Integer maxStringBytes = getMaxStringBytes(rexNodes.get(1), 
aggregateCall, plannerContext);
+        if (maxStringBytes == null) {
+          return null;
+        }
+        theAggFactory = aggregatorType.createAggregatorFactory(
+            aggregatorName,
+            fieldName,
+            null,
+            outputType,
+            maxStringBytes.intValue(),
+            true
+        );
+        break;
+      case 3:
+        maxStringBytes = getMaxStringBytes(rexNodes.get(1), aggregateCall, 
plannerContext);
+        if (maxStringBytes == null) {
+          return null;
+        }
+        boolean aggregateMultipleValues;
         try {
-          maxStringBytes = RexLiteral.intValue(rexNodes.get(1));
+          aggregateMultipleValues = 
RexLiteral.booleanValue(Preconditions.checkNotNull(rexNodes.get(2)));
         }
-        catch (AssertionError ae) {
+        catch (Exception ae) {
           plannerContext.setPlanningError(
-              "The second argument '%s' to function '%s' is not a number",
-              rexNodes.get(1),
+              "The third argument '%s' to function '%s' is not a boolean",
+              rexNodes.get(2),
               aggregateCall.getName()
           );

Review Comment:
   removed the code as early validation is added



-- 
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]

Reply via email to