weixiangsun commented on a change in pull request #8029:
URL: https://github.com/apache/pinot/pull/8029#discussion_r814082858



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##########
@@ -325,32 +342,30 @@ private static void setOptions(PinotQuery pinotQuery, 
List<String> optionsStatem
     pinotQuery.setQueryOptions(options);
   }
 
-  private static PinotQuery compileCalciteSqlToPinotQuery(String sql) {
-    SqlParser sqlParser = SqlParser.create(sql, PARSER_CONFIG);
-    SqlNode sqlNode;
-    try {
-      sqlNode = sqlParser.parseQuery();
-    } catch (SqlParseException e) {
-      throw new SqlCompilationException("Caught exception while parsing query: 
" + sql, e);
-    }
-
-    PinotQuery pinotQuery = new PinotQuery();
-    if (sqlNode instanceof SqlExplain) {
-      // Extract sql node for the query
-      sqlNode = ((SqlExplain) sqlNode).getExplicandum();
-      pinotQuery.setExplain(true);
-    }
-    SqlSelect selectNode;
+  private static SqlSelect getSelectNode(SqlNode sqlNode) {
+    SqlSelect selectNode = null;
     if (sqlNode instanceof SqlOrderBy) {
       // Store order-by info into the select sql node
       SqlOrderBy orderByNode = (SqlOrderBy) sqlNode;
       selectNode = (SqlSelect) orderByNode.query;
       selectNode.setOrderBy(orderByNode.orderList);
       selectNode.setFetch(orderByNode.fetch);
       selectNode.setOffset(orderByNode.offset);
-    } else {
+    } else if (sqlNode instanceof SqlSelect) {

Review comment:
       Revert the change. Fixed.




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to