KurtYoung commented on a change in pull request #8758: [FLINK-12867] Add insert 
overwrite grammar as HIVE dialect
URL: https://github.com/apache/flink/pull/8758#discussion_r294211461
 
 

 ##########
 File path: 
flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/dml/RichSqlInsert.java
 ##########
 @@ -93,6 +97,41 @@ public SqlNodeList getStaticPartitions() {
                getSource().unparse(writer, 0, 0);
        }
 
+       //~ Tools 
------------------------------------------------------------------
+
+       public static boolean isUpsert2(List<SqlLiteral> keywords) {
+               for (SqlNode keyword : keywords) {
+                       RichSqlInsertKeyword keyword2 =
+                               ((SqlLiteral) 
keyword).symbolValue(RichSqlInsertKeyword.class);
+                       if (keyword2 == RichSqlInsertKeyword.UPSERT) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       /** Returns whether this is an UPSERT. */
+       public boolean isUpsert2() {
+               return getModifierNode2(RichSqlInsertKeyword.UPSERT) != null;
+       }
+
+       /** Returns whether the insert mode is overwrite
+        * (for whole table or for specific partitions). */
+       public boolean isOverwrite() {
+               return getModifierNode2(RichSqlInsertKeyword.OVERWRITE) != null;
+       }
+
+       private SqlNode getModifierNode2(RichSqlInsertKeyword modifier) {
 
 Review comment:
   just name it with `getModifierNode`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to