You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "diqiu50 (via GitHub)" <gi...@apache.org> on 2026/06/04 07:57:14 UTC
[PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
diqiu50 opened a new pull request, #11429:
URL: https://github.com/apache/gravitino/pull/11429
### What changes were proposed in this pull request?
Support `ListType`, `MapType`, and `StructType` columns when creating Iceberg
tables via the Glue catalog.
### Why are the changes needed?
Creating an Iceberg table with complex column types via the Glue catalog threw
`UnsupportedOperationException`, while the standard Iceberg catalog worked fine.
Fix: #11329
### Does this PR introduce _any_ user-facing change?
Yes. Users can now create Iceberg tables with `ListType`, `MapType`, and
`StructType` columns via the Glue catalog.
### How was this patch tested?
- Unit tests in `TestGlueIcebergTableHelper`
- Integration test `AwsGlueCatalogIT#testCreateIcebergTableWithComplexTypes`
against real AWS Glue + S3
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#discussion_r3360896310
##########
catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueIcebergTableHelper.java:
##########
@@ -595,6 +602,42 @@ private static Schema toIcebergSchema(Column[] columns) {
}
private static org.apache.iceberg.types.Type toIcebergType(Type type) {
+ int[] nextId = {0};
Review Comment:
This local variant can be moved to the inner method?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#discussion_r3356109674
##########
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueIcebergTableHelper.java:
##########
@@ -130,6 +133,67 @@ void testFromIcebergTypeStruct() {
assertEquals(false, structType.fields()[1].nullable());
}
+ // -------------------------------------------------------------------------
+ // toIcebergSchema — complex types
+ // -------------------------------------------------------------------------
+
+ @Test
+ void testToIcebergSchemaWithListType() {
+ Column col =
+ GlueColumn.builder()
+ .withName("col_list")
+ .withType(Types.ListType.nullable(Types.StringType.get()))
+ .build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_list");
+ assertInstanceOf(org.apache.iceberg.types.Types.ListType.class, field.type());
+ org.apache.iceberg.types.Types.ListType listType =
+ (org.apache.iceberg.types.Types.ListType) field.type();
+ assertEquals(StringType.get(), listType.elementType());
+ assertTrue(listType.isElementOptional());
+ }
+
+ @Test
+ void testToIcebergSchemaWithMapType() {
+ Column col =
+ GlueColumn.builder()
+ .withName("col_map")
+ .withType(Types.MapType.of(Types.StringType.get(), Types.LongType.get(), false))
+ .build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_map");
+ assertInstanceOf(org.apache.iceberg.types.Types.MapType.class, field.type());
+ org.apache.iceberg.types.Types.MapType mapType =
+ (org.apache.iceberg.types.Types.MapType) field.type();
Review Comment:
Avoid fully qualified Iceberg type names in the test body; `NestedField`/`MapType` are already imported and there is no name collision here.
##########
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueIcebergTableHelper.java:
##########
@@ -130,6 +133,67 @@ void testFromIcebergTypeStruct() {
assertEquals(false, structType.fields()[1].nullable());
}
+ // -------------------------------------------------------------------------
+ // toIcebergSchema — complex types
+ // -------------------------------------------------------------------------
+
+ @Test
+ void testToIcebergSchemaWithListType() {
+ Column col =
+ GlueColumn.builder()
+ .withName("col_list")
+ .withType(Types.ListType.nullable(Types.StringType.get()))
+ .build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_list");
+ assertInstanceOf(org.apache.iceberg.types.Types.ListType.class, field.type());
+ org.apache.iceberg.types.Types.ListType listType =
+ (org.apache.iceberg.types.Types.ListType) field.type();
+ assertEquals(StringType.get(), listType.elementType());
+ assertTrue(listType.isElementOptional());
+ }
+
+ @Test
+ void testToIcebergSchemaWithMapType() {
+ Column col =
+ GlueColumn.builder()
+ .withName("col_map")
+ .withType(Types.MapType.of(Types.StringType.get(), Types.LongType.get(), false))
+ .build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_map");
+ assertInstanceOf(org.apache.iceberg.types.Types.MapType.class, field.type());
+ org.apache.iceberg.types.Types.MapType mapType =
+ (org.apache.iceberg.types.Types.MapType) field.type();
+ assertEquals(StringType.get(), mapType.keyType());
+ assertEquals(LongType.get(), mapType.valueType());
+ assertFalse(mapType.isValueOptional());
+ }
+
+ @Test
+ void testToIcebergSchemaWithStructType() {
+ Types.StructType gravitinoStruct =
+ Types.StructType.of(
+ Types.StructType.Field.of("name", Types.StringType.get(), true, "the name"),
+ Types.StructType.Field.of("age", Types.IntegerType.get(), false, null));
+ Column col = GlueColumn.builder().withName("col_struct").withType(gravitinoStruct).build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_struct");
+ assertInstanceOf(org.apache.iceberg.types.Types.StructType.class, field.type());
+ org.apache.iceberg.types.Types.StructType structType =
+ (org.apache.iceberg.types.Types.StructType) field.type();
Review Comment:
Avoid fully qualified Iceberg type names in the test body; `NestedField`/`StructType` are already imported and there is no name collision here.
##########
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueIcebergTableHelper.java:
##########
@@ -130,6 +133,67 @@ void testFromIcebergTypeStruct() {
assertEquals(false, structType.fields()[1].nullable());
}
+ // -------------------------------------------------------------------------
+ // toIcebergSchema — complex types
+ // -------------------------------------------------------------------------
+
+ @Test
+ void testToIcebergSchemaWithListType() {
+ Column col =
+ GlueColumn.builder()
+ .withName("col_list")
+ .withType(Types.ListType.nullable(Types.StringType.get()))
+ .build();
+ Schema schema = GlueIcebergTableHelper.toIcebergSchema(new Column[] {col});
+
+ org.apache.iceberg.types.Types.NestedField field = schema.findField("col_list");
+ assertInstanceOf(org.apache.iceberg.types.Types.ListType.class, field.type());
+ org.apache.iceberg.types.Types.ListType listType =
+ (org.apache.iceberg.types.Types.ListType) field.type();
+ assertEquals(StringType.get(), listType.elementType());
Review Comment:
Avoid fully qualified Iceberg type names in the test body; `NestedField`/`ListType` are already imported and there is no name collision here. Using simple names matches the repo import convention and keeps the test readable.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades merged PR #11429:
URL: https://github.com/apache/gravitino/pull/11429
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#discussion_r3370456410
##########
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:
Fixed
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#issuecomment-4621255157
<!-- coverage-report -->
### Code Coverage Report
|Overall Project|66.8% **`-0.14%`**|:green_circle:|
|:-|:-|:-:|
|Files changed|38.66%|:red_circle:|
<br>
|Module|Coverage||
|:-|:-|:-:|
|aliyun|1.72%|:red_circle:|
|api|46.82%|:green_circle:|
|authorization-common|85.96%|:green_circle:|
|aws|3.66%|:red_circle:|
|azure|2.47%|:red_circle:|
|catalog-common|10.04%|:red_circle:|
|catalog-fileset|80.33%|:green_circle:|
|catalog-glue|67.46% **`-12.97%`**|:green_circle:|
|catalog-hive|79.33%|:green_circle:|
|catalog-jdbc-clickhouse|80.02%|:green_circle:|
|catalog-jdbc-common|45.31%|:green_circle:|
|catalog-jdbc-doris|80.28%|:green_circle:|
|catalog-jdbc-hologres|54.03%|:green_circle:|
|catalog-jdbc-mysql|79.23%|:green_circle:|
|catalog-jdbc-oceanbase|78.38%|:green_circle:|
|catalog-jdbc-postgresql|82.29%|:green_circle:|
|catalog-jdbc-starrocks|78.51%|:green_circle:|
|catalog-kafka|77.01%|:green_circle:|
|catalog-lakehouse-generic|44.89%|:green_circle:|
|catalog-lakehouse-hudi|79.1%|:green_circle:|
|catalog-lakehouse-iceberg|85.66%|:green_circle:|
|catalog-lakehouse-paimon|79.29%|:green_circle:|
|catalog-model|77.72%|:green_circle:|
|cli|44.51%|:green_circle:|
|client-java|77.91%|:green_circle:|
|common|49.99%|:green_circle:|
|core|82.49%|:green_circle:|
|filesystem-hadoop3|76.97%|:green_circle:|
|flink|0.0%|:red_circle:|
|flink-common|41.2%|:green_circle:|
|flink-runtime|0.0%|:red_circle:|
|gcp|14.12%|:red_circle:|
|hadoop-common|10.39%|:red_circle:|
|hive-metastore-common|53.26%|:green_circle:|
|iceberg-common|56.54%|:green_circle:|
|iceberg-rest-server|72.76%|:green_circle:|
|idp-basic|85.99%|:green_circle:|
|integration-test-common|0.0%|:red_circle:|
|jobs|66.17%|:green_circle:|
|lance-common|20.83%|:red_circle:|
|lance-rest-server|60.27%|:green_circle:|
|lineage|53.02%|:green_circle:|
|optimizer|82.95%|:green_circle:|
|optimizer-api|21.95%|:red_circle:|
|server|85.73%|:green_circle:|
|server-common|73.16%|:green_circle:|
|spark|29.85%|:red_circle:|
|spark-common|40.78%|:green_circle:|
|trino-connector|39.44%|:red_circle:|
<details>
<summary>Files</summary>
|Module|File|Coverage||
|:-|:-|:-|:-:|
|catalog-glue|[GlueIcebergTableHelper.java](https://github.com/diqiu50/gravitino/blob/e34c397e544a0f8f1aba065152469edd43adc1f6/catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueIcebergTableHelper.java)|38.66%|:red_circle:|
</details>
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11329] fix(catalog-glue): Support complex types for Iceberg tables in Glue catalog [gravitino]
Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #11429:
URL: https://github.com/apache/gravitino/pull/11429#discussion_r3360896310
##########
catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueIcebergTableHelper.java:
##########
@@ -595,6 +602,42 @@ private static Schema toIcebergSchema(Column[] columns) {
}
private static org.apache.iceberg.types.Type toIcebergType(Type type) {
+ int[] nextId = {0};
Review Comment:
This local variant can be moved to the inner method?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org