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

 ##########
 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) {
+          throw new Pql2CompilationException("Distinct expects 1 or more 
arguments as column names");
+        } else {
+          final StringBuilder distinctColumnExpr = new StringBuilder();
+          for (int i = 0; i < children.size() ; ++i) {
 
 Review comment:
   May be optimize the common case of single argument by avoiding StringBuilder?

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