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

 ##########
 File path: 
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
 ##########
 @@ -174,13 +185,24 @@ private static String removeOptionsFromSql(String sql) {
     return matcher.replaceAll("");
   }
 
+  private static List<Expression> convertDistinctSelectList(SqlNodeList 
selectList) {
+    List<Expression> selectExpr = new ArrayList<>();
+    if (!Pql2Compiler.ENABLE_DISTINCT) {
+      throw new SqlCompilationException("Support for DISTINCT is currently 
disabled in Pinot");
+    }
+    
selectExpr.add(convertDistinctAndSelectListToFunctionExpression(selectList));
+    return selectExpr;
+  }
+
   private static List<Expression> convertSelectList(SqlNodeList selectList) {
     List<Expression> selectExpr = new ArrayList<>();
+
     final Iterator<SqlNode> iterator = selectList.iterator();
     while (iterator.hasNext()) {
       final SqlNode next = iterator.next();
       selectExpr.add(toExpression(next));
 
 Review comment:
   Good catch. For the DISTINCT code via PQL, I deduplicate columns. For 
calcite compilation path, I can do that in a follow-up since it needs to be 
done for selection also.

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