LakshSingla commented on a change in pull request #12163:
URL: https://github.com/apache/druid/pull/12163#discussion_r794930536



##########
File path: 
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -765,13 +786,65 @@ static ParsedNodes create(final SqlNode node) throws 
ValidationException
       if (query.getKind() == SqlKind.INSERT) {
         insert = (SqlInsert) query;
         query = insert.getSource();
+
+        // Processing to be done when the original query has either of the 
PARTITION BY or CLUSTER BY clause
+        if (insert instanceof DruidSqlInsert) {

Review comment:
       On removing the if-else statements, the test case like: `EXPLAIN PLAN 
FOR INSERT INTO dst SELECT * FROM EXTERN(...)` was failing.
   This is because SqlExplain(), still doesn't know about the existence of the 
DruidSqlInsert node, and returns a SqlInsert() on such queries. Since we don't 
want the queries to fail on them, it is necessary to keep the unnessecary 
if-else checks. (I have cleaned up some code in the ftl file though).
   
   Once `EXPLAIN PLAN FOR` works with the modified syntax, there would no 
longer be any requirements for the check. (I do have a patch that does the 
same, however, it involves rewriting a small part of the code from the Calcite 
parser, which I am wary of since we wanna avoid that). I will update the patch 
on the comments section of PR later (it might have become obsolete due to 
changing of the keywords).  




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