fsk119 commented on code in PR #21640:
URL: https://github.com/apache/flink/pull/21640#discussion_r1067731513
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/SqlToOperationConverter.java:
##########
@@ -480,6 +481,9 @@ private Operation convertAlterTable(SqlAlterTable
sqlAlterTable) {
Optional<ContextResolvedTable> optionalCatalogTable =
catalogManager.getTable(tableIdentifier);
if (!optionalCatalogTable.isPresent() ||
optionalCatalogTable.get().isTemporary()) {
+ if (sqlAlterTable.ignoreIfNotExists()) {
+ return new NopOperation();
+ }
Review Comment:
I think we should add ignoreIfNotExists field in the `AlterTableOperation`.
It's possible that the source table is dropped in execution.
##########
flink-table/flink-sql-parser/src/main/java/org/apache/flink/sql/parser/ddl/SqlAlterTable.java:
##########
@@ -98,6 +111,15 @@ public LinkedHashMap<String, String> getPartitionKVs() {
return SqlPartitionUtils.getPartitionKVs(getPartitionSpec());
}
+ /**
+ * Whether to ignore the error if the table doesn't exist.
+ *
+ * @return true when IF EXISTS is specified.
+ */
+ public boolean ignoreIfNotExists() {
Review Comment:
BTW, I think we should keep the code style same. In the `SqlAlterFunction`,
we use `isIfExists` as method name.
--
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]