somu-imply commented on code in PR #14510:
URL: https://github.com/apache/druid/pull/14510#discussion_r1283808117


##########
sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/StringSqlAggregator.java:
##########
@@ -96,37 +107,38 @@ public Aggregation toDruidAggregation(
       return null;
     }
 
-    RexNode separatorNode = Expressions.fromFieldAccess(
-        rexBuilder.getTypeFactory(),
-        rowSignature,
-        project,
-        aggregateCall.getArgList().get(1)
-    );
-    if (!separatorNode.isA(SqlKind.LITERAL)) {
-      // separator must be a literal
-      return null;
-    }
-    String separator = RexLiteral.stringValue(separatorNode);
+    final String separator;
 
-    if (separator == null) {
-      // separator must not be null
-      return null;
+    if (arguments.size() > 1) {
+      separator = RexLiteral.stringValue(
+          Expressions.fromFieldAccess(
+              rexBuilder.getTypeFactory(),
+              rowSignature,
+              project,
+              aggregateCall.getArgList().get(1)
+          )
+      );
+    } else {
+      separator = "";
     }
 
-    Integer maxSizeBytes = null;
+    final HumanReadableBytes maxSizeBytes;
+
     if (arguments.size() > 2) {
-      RexNode maxBytes = Expressions.fromFieldAccess(
-          rexBuilder.getTypeFactory(),
-          rowSignature,
-          project,
-          aggregateCall.getArgList().get(2)
+      maxSizeBytes = HumanReadableBytes.valueOf(
+          RexLiteral.intValue(
+              Expressions.fromFieldAccess(
+                  rexBuilder.getTypeFactory(),
+                  rowSignature,
+                  project,
+                  aggregateCall.getArgList().get(2)
+              )
+          )

Review Comment:
   Addressed



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