You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/01/16 23:18:45 UTC

[GitHub] [pinot] weixiangsun commented on a change in pull request #8029: Add Pre-Aggregation Gapfilling functionality.

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



##########
File path: pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##########
@@ -117,21 +117,50 @@ private static String removeTerminatingSemicolon(String sql) {
     return sql;
   }
 
+  private static SqlNode parse(String sql) {
+    SqlParser sqlParser = SqlParser.create(sql, PARSER_CONFIG);
+    try {
+      return sqlParser.parseQuery();
+    } catch (SqlParseException e) {
+      throw new SqlCompilationException("Caught exception while parsing query: " + sql, e);
+    }
+  }
+
+  public static PinotQuery compileToPinotQueryWithSubquery(String sql)
+      throws SqlCompilationException {
+    return compileToPinotQuery(sql, true);
+  }
+
   public static PinotQuery compileToPinotQuery(String sql)
       throws SqlCompilationException {
-    // Remove the comments from the query
-    sql = removeComments(sql);
+    return compileToPinotQuery(sql, false);
+  }
 
-    // Remove the terminating semicolon from the query
+  private static PinotQuery compileToPinotQuery(String sql, boolean enablePreAggregateGapfillQuery)
+      throws SqlCompilationException {
+    // Removes the terminating semicolon if any
     sql = removeTerminatingSemicolon(sql);
 
     // Extract OPTION statements from sql as Calcite Parser doesn't parse it.
     List<String> options = extractOptionsFromSql(sql);
     if (!options.isEmpty()) {
       sql = removeOptionsFromSql(sql);
     }
+
+    SqlNode sqlNode = parse(sql);
+
     // Compile Sql without OPTION statements.
-    PinotQuery pinotQuery = compileCalciteSqlToPinotQuery(sql);
+    PinotQuery pinotQuery = compileSqlNodeToPinotQuery(sqlNode);
+
+    if (enablePreAggregateGapfillQuery) {

Review comment:
       We can not leverage this IN_SUBQUERY feature https://docs.pinot.apache.org/users/user-guide-query/filtering-with-idset#in_subquery since the query syntax is trying to follow the real subquery approach.
   
   The reason of this special-casing is that we are not blocking subquery feature development. We are planning to make our feature compatible with subquery feature when it is in place.




-- 
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-unsubscribe@pinot.apache.org

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



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