flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject [flink] 01/02: [FLINK-23168][table-common][table-api-java] GenericInMemoryCatalog shouldn't merge properties for alter DB operation
Date Fri, 02 Jul 2021 12:51:31 GMT
This is an automated email from the ASF dual-hosted git repository.

lirui pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git

commit d0bf474cec5cc079172160ba070070de1a14e59c
Author: Rui Li <lirui@apache.org>
AuthorDate: Wed Jun 30 20:52:57 2021 +0800

    [FLINK-23168][table-common][table-api-java] GenericInMemoryCatalog shouldn't merge properties
for alter DB operation
---
 flink-python/pyflink/table/tests/test_catalog.py                  | 6 +++---
 .../org/apache/flink/table/catalog/GenericInMemoryCatalog.java    | 4 +---
 .../src/test/java/org/apache/flink/table/catalog/CatalogTest.java | 8 +++-----
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/flink-python/pyflink/table/tests/test_catalog.py b/flink-python/pyflink/table/tests/test_catalog.py
index f6f6501..dcc1bc7 100644
--- a/flink-python/pyflink/table/tests/test_catalog.py
+++ b/flink-python/pyflink/table/tests/test_catalog.py
@@ -258,10 +258,10 @@ class CatalogTestBase(PyFlinkTestCase):
         new_db = self.create_another_db()
         self.catalog.alter_database(self.db1, new_db, False)
 
-        merged_properties = db.get_properties().copy()
-        merged_properties.update(new_db.get_properties())
         new_properties = self.catalog.get_database(self.db1).get_properties()
-        self.assertTrue(all(kv in new_properties.items() for kv in merged_properties.items()))
+        old_properties = db.get_properties()
+        self.assertFalse(all(k in new_properties for k in old_properties.keys()))
+        self.check_catalog_database_equals(new_db, self.catalog.get_database(self.db1))
 
     def test_alter_db_database_not_exist_exception(self):
         with self.assertRaises(DatabaseNotExistException):
diff --git a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
index 32e0561..9de620f 100644
--- a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
+++ b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java
@@ -174,9 +174,7 @@ public class GenericInMemoryCatalog extends AbstractCatalog {
                                 newDatabase.getClass().getName()));
             }
 
-            Map<String, String> mergedProperties = new HashMap<>(existingDatabase.getProperties());
-            mergedProperties.putAll(newDatabase.getProperties());
-            databases.put(databaseName, newDatabase.copy(mergedProperties));
+            databases.put(databaseName, newDatabase.copy());
         } else if (!ignoreIfNotExists) {
             throw new DatabaseNotExistException(getName(), databaseName);
         }
diff --git a/flink-table/flink-table-common/src/test/java/org/apache/flink/table/catalog/CatalogTest.java
b/flink-table/flink-table-common/src/test/java/org/apache/flink/table/catalog/CatalogTest.java
index 4c968ea..1fc421f 100644
--- a/flink-table/flink-table-common/src/test/java/org/apache/flink/table/catalog/CatalogTest.java
+++ b/flink-table/flink-table-common/src/test/java/org/apache/flink/table/catalog/CatalogTest.java
@@ -203,14 +203,12 @@ public abstract class CatalogTest {
         CatalogDatabase newDb = createAnotherDb();
         catalog.alterDatabase(db1, newDb, false);
 
-        Map<String, String> mergedProps = new HashMap<>(db.getProperties());
-        mergedProps.putAll(newDb.getProperties());
-
-        assertTrue(
+        assertFalse(
                 catalog.getDatabase(db1)
                         .getProperties()
                         .entrySet()
-                        .containsAll(mergedProps.entrySet()));
+                        .containsAll(db.getProperties().entrySet()));
+        CatalogTestUtil.checkEquals(newDb, catalog.getDatabase(db1));
     }
 
     @Test

Mime
View raw message