gianm commented on a change in pull request #12246:
URL: https://github.com/apache/druid/pull/12246#discussion_r803071379



##########
File path: 
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlInsert.java
##########
@@ -62,10 +68,14 @@ public DruidSqlInsert(
         insertNode.getSource(),
         insertNode.getTargetColumnList()
     );
-    Preconditions.checkNotNull(partitionedBy); // Shouldn't hit due to how the 
parser is written
+    if (partitionedBy == null) {
+      throw new ParseException("INSERT statements should specify PARTITIONED 
BY clause explictly");

Review comment:
       The word "must" is better than "should" here. (RFC 2119 doesn't govern 
here, but is still a helpful guide for technical writing. "Should" means 
"recommended, but not strictly required".)

##########
File path: 
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlInsert.java
##########
@@ -48,12 +48,18 @@
   @Nullable
   private final SqlNodeList clusteredBy;
 
+  /**
+   * While partitionedBy and partitionedByStringForUnparse can be null as 
arguments to the constructor, this is
+   * disallowed (semantically) and the constructor performs checks to ensure 
that. This helps in producing friendly
+   * errors when the PARTITIONED BY custom clause is not present, and keeps 
its error separate from JavaCC/Calcite's
+   * custom errors which can be cryptic when someone accidentaly forgets to 
explicitly specify the PARTITIONED BY clause

Review comment:
       accidentally (spelling)




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