Zephyr589 commented on code in PR #4658:
URL: https://github.com/apache/iceberg/pull/4658#discussion_r867321186


##########
flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -229,6 +229,20 @@ public void dropDatabase(String name, boolean 
ignoreIfNotExists, boolean cascade
       throws DatabaseNotExistException, DatabaseNotEmptyException, 
CatalogException {
     if (asNamespaceCatalog != null) {
       try {
+        if (cascade) {
+          List<ObjectPath> deleteTablePaths = 
icebergCatalog.listTables(toNamespace(name)).stream()
+                  .map(s -> ObjectPath.fromString(s.toString()))
+                  .collect(Collectors.toList());
+          deleteTablePaths.forEach(
+                  objectPath -> {
+                    try {
+                      dropTable(objectPath, true);
+                    } catch (TableNotExistException ex) {

Review Comment:
   Since I made these changes based on the way Flink implements it, I think we 
should not change it.
   
![image](https://user-images.githubusercontent.com/74643176/167244998-a5dab84a-e38f-4919-82d1-9326fe4fe518.png)
   
   



##########
flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -229,6 +229,20 @@ public void dropDatabase(String name, boolean 
ignoreIfNotExists, boolean cascade
       throws DatabaseNotExistException, DatabaseNotEmptyException, 
CatalogException {
     if (asNamespaceCatalog != null) {
       try {
+        if (cascade) {
+          List<ObjectPath> deleteTablePaths = 
icebergCatalog.listTables(toNamespace(name)).stream()

Review Comment:
   If droping a database and droping a table under it happen at the same time, 
it will make no influence.
   If droping a database and creating a table under it happen at the same time, 
it will fail, and we just need to retry it. 



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