RocMarshal commented on a change in pull request #18146:
URL: https://github.com/apache/flink/pull/18146#discussion_r772210693



##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
##########
@@ -169,6 +186,51 @@ public void testCreateCatalogFromUserClassLoader() throws 
Exception {
         }
     }
 
+    @Test
+    public void testGetTablesFromGivenCatalogDatabase()
+            throws TableAlreadyExistException, DatabaseNotExistException,
+                    DatabaseAlreadyExistException {
+        final Catalog c1 = new GenericInMemoryCatalog("c1", "default");
+        final Catalog c2 = new GenericInMemoryCatalog("c2", "d2");
+
+        final CatalogManager catalogManager =
+                
CatalogManagerMocks.preparedCatalogManager().defaultCatalog("c2", c2).build();
+        catalogManager.registerCatalog("c1", c1);
+        c1.createDatabase(
+                "d1",
+                new CatalogDatabaseImpl(
+                        new HashMap<String, String>() {
+                            {
+                                put("k1", "v1");
+                            }
+                        },
+                        ""),
+                true);
+        final ObjectPath path1 = new ObjectPath("d1", "t1");
+        final ObjectPath path2 = new 
ObjectPath(catalogManager.getCurrentDatabase(), "t2");
+
+        final TableSchema tableSchema =
+                TableSchema.builder()
+                        .field("a", DataTypes.BIGINT())
+                        .field("b", DataTypes.VARCHAR(Integer.MAX_VALUE))
+                        .field("c", DataTypes.INT())
+                        .field("d", DataTypes.VARCHAR(Integer.MAX_VALUE))
+                        .build();
+        Map<String, String> options = new HashMap<>();
+        options.put("connector", "COLLECTION");
+        final CatalogTable catalogTable = new CatalogTableImpl(tableSchema, 
options, "");

Review comment:
       nit: `new CatalogTableImpl(...)`->`CatalogTable.of(...)`.

##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/catalog/CatalogITCase.java
##########
@@ -169,6 +186,51 @@ public void testCreateCatalogFromUserClassLoader() throws 
Exception {
         }
     }
 
+    @Test
+    public void testGetTablesFromGivenCatalogDatabase()
+            throws TableAlreadyExistException, DatabaseNotExistException,
+                    DatabaseAlreadyExistException {
+        final Catalog c1 = new GenericInMemoryCatalog("c1", "default");
+        final Catalog c2 = new GenericInMemoryCatalog("c2", "d2");
+
+        final CatalogManager catalogManager =
+                
CatalogManagerMocks.preparedCatalogManager().defaultCatalog("c2", c2).build();
+        catalogManager.registerCatalog("c1", c1);
+        c1.createDatabase(
+                "d1",
+                new CatalogDatabaseImpl(
+                        new HashMap<String, String>() {
+                            {
+                                put("k1", "v1");
+                            }
+                        },
+                        ""),
+                true);
+        final ObjectPath path1 = new ObjectPath("d1", "t1");
+        final ObjectPath path2 = new 
ObjectPath(catalogManager.getCurrentDatabase(), "t2");
+
+        final TableSchema tableSchema =

Review comment:
       It would be better if we use `final Schema tableSchema =
                   Schema.newBuilder().....` here.




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