xiangfu0 commented on code in PR #11451:
URL: https://github.com/apache/pinot/pull/11451#discussion_r1309514468


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java:
##########
@@ -239,6 +239,21 @@ private String getQueryResponse(String query, @Nullable 
SqlNode sqlNode, String
       tableName = 
_pinotHelixResourceManager.getActualTableName(inputTableName);
     } catch (Exception e) {
       LOGGER.error("Caught exception while compiling query: {}", query, e);
+      try {
+        // try to compile the query using multi-stage engine and suggest using 
it if it succeeds.
+        LOGGER.info("Trying to compile query {} using multi-stage engine", 
query);
+        QueryEnvironment queryEnvironment = new QueryEnvironment(new 
TypeFactory(new TypeSystem()),
+            CalciteSchemaBuilder.asRootSchema(new 
PinotCatalog(_pinotHelixResourceManager.getTableCache())), null,
+            null);
+        queryEnvironment.getTableNamesForQuery(query);
+        LOGGER.info("Successfully compiled query using multi-stage engine: 
{}", query);
+        return QueryException.getException(QueryException.SQL_PARSING_ERROR, 
new Exception(
+            "It seems that the query contains join, please try the multi-stage 
engine by checking the "

Review Comment:
   The query may contain other multi-stage execution plan, e.g. (joins, 
sub-query, set operation, etc)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to