siddharthteotia commented on a change in pull request #4535: Implement DISTINCT 
clause
URL: https://github.com/apache/incubator-pinot/pull/4535#discussion_r315384386
 
 

 ##########
 File path: 
pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java
 ##########
 @@ -82,10 +85,30 @@ public AggregationInfo buildAggregationInfo() {
       expression = "*";
     } else {
       List<? extends AstNode> children = getChildren();
-      if (children == null || children.size() != 1) {
-        throw new Pql2CompilationException("Aggregation function expects exact 
1 argument");
+      if (children == null) {
+        throw new Pql2CompilationException("Aggregation function expects 
non-null argument");
+      }
+      if (!_name.equalsIgnoreCase("distinct")) {
+        if (children.size() != 1) {
+          throw new Pql2CompilationException("Aggregation function expects 
exactly 1 argument as column name");
+        } else {
+          expression = 
TransformExpressionTree.getStandardExpression(children.get(0));
+        }
+      } else {
+        if (children.size() < 1) {
 
 Review comment:
   Done -- Included the size as part of null check in parent else. Will throw 
compilation exception if either null or empty children

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to