stevenzwu commented on code in PR #12199:
URL: https://github.com/apache/iceberg/pull/12199#discussion_r1977919523


##########
flink/v1.20/flink/src/test/java/org/apache/iceberg/flink/TestFlinkCatalogTable.java:
##########
@@ -188,6 +188,37 @@ public void testCreateTableLike() throws 
TableNotExistException {
         .isEqualTo(TableSchema.builder().field("id", 
DataTypes.BIGINT()).build());
   }
 
+  @TestTemplate
+  public void testCreateTableLikeInDiffIcebergCatalog() throws 
TableNotExistException {
+    sql("CREATE TABLE tl(id BIGINT)");
+    sql("CREATE TABLE tl2 LIKE tl");
+
+    Table table = table("tl2");
+    assertThat(table.schema().asStruct())
+        .isEqualTo(
+            new Schema(Types.NestedField.optional(1, "id", 
Types.LongType.get())).asStruct());
+    CatalogTable catalogTable = catalogTable("tl2");
+    assertThat(catalogTable.getSchema())
+        .isEqualTo(TableSchema.builder().field("id", 
DataTypes.BIGINT()).build());
+  }
+
+  @TestTemplate
+  public void testCreateTableLikeInFlinkCatalog() throws 
TableNotExistException {
+    sql("CREATE TABLE tl(id BIGINT)");
+
+    sql("CREATE TABLE `default_catalog`.`default_database`.tl2 LIKE tl");
+
+    CatalogTable catalogTable = catalogTable("default_catalog", 
"default_database", "tl2");
+    assertThat(catalogTable.getSchema())
+        .isEqualTo(TableSchema.builder().field("id", 
DataTypes.BIGINT()).build());
+
+    String srcCatalogProps = FlinkCreateTableOptions.toJson(catalogName, 
DATABASE, "tl", config);
+    Map<String, String> options = catalogTable.getOptions();
+    assertThat(options.get("connector")).isEqualTo("iceberg");

Review Comment:
   nit: constants can be used for the 2 literals 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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to