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


##########
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:
    why are we talking about backticks?
   we are initilalizing it in `case ... when` above
   we completely control this value in this method 
https://github.com/apache/flink/pull/25810/files#diff-08fa556e87b631fc6962a1fb5abfbf976fd9b12398a6a8ec40eda3b04c293a14R1318-R1329
   It has nothing to do with table name which probably you might have thought of



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