davidradl commented on code in PR #25810:
URL: https://github.com/apache/flink/pull/25810#discussion_r1894988339


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java:
##########
@@ -1297,30 +1303,42 @@ public void dropMaterializedTable(
      * @param objectIdentifier The fully qualified path of the view to drop.
      * @param ignoreIfNotExists If false exception will be thrown if the view 
to drop does not
      *     exist.
+     * @return true if view existed in the given path and was dropped, false 
if view didn't exist in
+     *     the given path and ignoreIfNotExists was true.
      */
-    public void dropView(ObjectIdentifier objectIdentifier, boolean 
ignoreIfNotExists) {
-        dropTableInternal(objectIdentifier, ignoreIfNotExists, false, false);
-    }
+    public boolean dropView(ObjectIdentifier objectIdentifier, boolean 
ignoreIfNotExists) {
+        return dropTableInternal(objectIdentifier, ignoreIfNotExists, 
TableKind.VIEW);
+    }
+
+    private boolean dropTableInternal(
+            ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists, 
TableKind kind) {
+        final Predicate<CatalogBaseTable> filter;
+        final String tableOrView;
+        switch (kind) {
+            case VIEW:
+                filter = table -> table instanceof CatalogView;
+                tableOrView = "View";
+                break;
+            case TABLE:
+                filter = table -> table instanceof CatalogTable;
+                tableOrView = "Table";
+                break;
+            case MATERIALIZED_TABLE:
+                filter = table -> table instanceof CatalogMaterializedTable;
+                tableOrView = "Materialized Table";
+                break;
+            default:
+                throw new ValidationException("Not supported table kind: " + 
kind);
+        }
 
-    private void dropTableInternal(
-            ObjectIdentifier objectIdentifier,
-            boolean ignoreIfNotExists,
-            boolean isDropTable,
-            boolean isDropMaterializedTable) {
-        Predicate<CatalogBaseTable> filter =
-                isDropTable
-                        ? isDropMaterializedTable
-                                ? table -> table instanceof 
CatalogMaterializedTable
-                                : table -> table instanceof CatalogTable
-                        : table -> table instanceof CatalogView;
         // Same name temporary table or view exists.
         if (filter.test(temporaryTables.get(objectIdentifier))) {
-            String tableOrView = isDropTable ? "table" : "view";
+            final String lowerTableOrView = 
tableOrView.toLowerCase(Locale.ROOT);

Review Comment:
   I am curious what if the table name is back ticked?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to