mchades commented on code in PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#discussion_r3360405866


##########
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/integration/test/AwsGlueCatalogIT.java:
##########
@@ -89,6 +91,65 @@ protected Map<String, String> catalogConfig() {
     return config;
   }
 
+  @Test
+  void testCreateIcebergTableWithComplexTypes() {
+    String bucket = System.getenv("AWS_S3_TEST_BUCKET");
+    String schema = "glue_it_" + System.nanoTime();
+    ops.createSchema(NameIdentifier.of("ml", "cat", schema), null, 
Collections.emptyMap());
+
+    Map<String, String> props = new HashMap<>();
+    props.put(GlueConstants.TABLE_FORMAT, "ICEBERG");
+    props.put(GlueConstants.LOCATION, "s3://" + bucket + "/" + schema + "/");
+
+    Column[] cols = {
+      Column.of("tags", Types.ListType.nullable(Types.StringType.get()), "list 
col"),
+      Column.of(
+          "scores",
+          Types.MapType.of(Types.StringType.get(), Types.DoubleType.get(), 
false),
+          "map col"),
+      Column.of(
+          "info",
+          Types.StructType.of(
+              Types.StructType.Field.of("name", Types.StringType.get(), true, 
null),
+              Types.StructType.Field.of("age", Types.IntegerType.get(), false, 
null)),
+          "struct col"),
+    };
+
+    ops.createTable(
+        NameIdentifier.of("ml", "cat", schema, "ice_complex"),
+        cols,
+        null,
+        props,
+        new Transform[0],
+        Distributions.NONE,
+        new SortOrder[0],
+        new Index[0]);
+
+    try {
+      Table loaded = ops.loadTable(NameIdentifier.of("ml", "cat", schema, 
"ice_complex"));
+      assertEquals(3, loaded.columns().length);
+
+      Types.ListType listType = (Types.ListType) 
loaded.columns()[0].dataType();
+      assertEquals(Types.StringType.get(), listType.elementType());
+      assertTrue(listType.elementNullable());
+
+      Types.MapType mapType = (Types.MapType) loaded.columns()[1].dataType();
+      assertEquals(Types.StringType.get(), mapType.keyType());
+      assertEquals(Types.DoubleType.get(), mapType.valueType());
+      assertFalse(mapType.valueNullable());
+
+      Types.StructType structType = (Types.StructType) 
loaded.columns()[2].dataType();
+      assertEquals(2, structType.fields().length);
+      assertEquals("name", structType.fields()[0].name());
+      assertEquals(Types.StringType.get(), structType.fields()[0].type());
+      assertEquals("age", structType.fields()[1].name());
+      assertEquals(Types.IntegerType.get(), structType.fields()[1].type());

Review Comment:
   why not assert comment field?



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

Reply via email to