danhuawang opened a new issue, #10994:
URL: https://github.com/apache/gravitino/issues/10994

   ### What would you like to be improved?
   
   When using Gravitino Iceberg REST Server (backed by JDBC catalog) with 
Iceberg 1.10.1,
   creating a table that contains a `variant` column (an Iceberg V3 new type) 
fails with HTTP 406.
   
   **Environment:**
   - Gravitino Iceberg REST Server: backed by JDBC catalog
   - Iceberg version: 1.10.1 (both Spark client and Gravitino server side)
   - Spark version: 4.1.1
   - Table format version: 3
   
   **Reproduction steps:**
   
   ```sql
   CREATE TABLE <catalog>.<db>.test_v3 (
       id     BIGINT,
       data   STRING,
       info   VARIANT
   )
   USING iceberg
   TBLPROPERTIES ('format-version' = '3');
   ```
   
   **Error observed in Gravitino Iceberg REST Server log:**
   
   ```
   2026-05-08 07:58:15.447 INFO [iceberg-rest-128] 
[org.apache.gravitino.iceberg.service.rest.IcebergTableOperations.createTable(IcebergTableOperations.java:169)]
 - Create Iceberg table, catalog: catalog_1, namespace: spark_db_v3, create 
table request: CreateTableRequest{name=test_v3_2, location=null, 
properties={format-version=3, owner=wangdanhua}, schema=table {
     0: id: optional long
     1: data: optional string
     2: info: optional variant
   }, partitionSpec=org.apache.iceberg.UnboundPartitionSpec@a19ad1c, 
writeOrder=null, stageCreate=false}, accessDelegation: vended-credentials, 
isCredentialVending: true
   2026-05-08 07:58:15.448 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreCatalog$BaseMetastoreCatalogTableBuilder.tableDefaultProperties(BaseMetastoreCatalog.java:269)]
 - Table properties set at catalog level through catalog properties: {}
   2026-05-08 07:58:15.449 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreCatalog$BaseMetastoreCatalogTableBuilder.tableOverrideProperties(BaseMetastoreCatalog.java:283)]
 - Table properties enforced at catalog level through catalog properties: {}
   2026-05-08 07:58:15.696 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:130)]
 - Successfully committed to table spark_db_v3.test_v3_2 in 246 ms
   2026-05-08 07:58:15.697 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreTableOperations.refreshFromMetadataLocation(BaseMetastoreTableOperations.java:190)]
 - Refreshing table metadata from new version: 
s3://irc-e2e-env1-metalake-b-warehouse/env1/metalake_b/catalog_1/spark_db_v3/test_v3_2/metadata/00000-24f27ee2-c7eb-43ef-8d7c-6ced1d985332.metadata.json
   2026-05-08 07:58:16.094 INFO [iceberg-rest-128] 
[org.apache.gravitino.iceberg.service.CatalogWrapperForREST.injectCredentialConfig(CatalogWrapperForREST.java:312)]
 - Generate credential: s3-token for Iceberg table: spark_db_v3.test_v3_2
   2026-05-08 07:58:16.096 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreTableOperations.refreshFromMetadataLocation(BaseMetastoreTableOperations.java:190)]
 - Refreshing table metadata from new version: 
s3://irc-e2e-env1-metalake-b-warehouse/env1/metalake_b/catalog_1/spark_db_v3/test_v3_2/metadata/00000-24f27ee2-c7eb-43ef-8d7c-6ced1d985332.metadata.json
   2026-05-08 07:58:16.147 INFO [iceberg-rest-128] 
[org.apache.iceberg.BaseMetastoreCatalog.loadTable(BaseMetastoreCatalog.java:69)]
 - Table loaded by catalog: jdbc.spark_db_v3.test_v3_2
   2026-05-08 07:58:16.149 INFO [iceberg-rest-128] 
[org.apache.gravitino.iceberg.service.IcebergExceptionMapper.toRESTResponse(IcebergExceptionMapper.java:136)]
 - Iceberg REST server error maybe caused by user request, response http 
status: 406, exception: class java.lang.UnsupportedOperationException, 
exception message: Unsupported type: variant
   
   ```
   
   **Root cause analysis:**
   
   The `createTable` call itself succeeds — the metadata file is committed to 
S3 successfully.
   However, the subsequent `loadTable` call (triggered internally after 
`createTable` to build
   the `LoadTableResponse`) fails because the JDBC catalog's internal schema 
processing path
   (a `TypeVisitor` or schema serialization utility inside Iceberg's 
`BaseMetastoreCatalog`)
   does not have a complete implementation for the `VariantType` introduced in 
Iceberg V3.
   
   The call chain is:
   
   ```
   CatalogWrapperForREST.createTable()
     → super.createTable()                    // commits metadata successfully ✅
     → BaseMetastoreCatalog.loadTable()       // fails on variant type ❌
       → UnsupportedOperationException: Unsupported type: variant
   ```
   
   Gravitino maps `UnsupportedOperationException` → HTTP 406, which is returned 
to Spark.
   
   Although [iceberg.apache.org/status/](https://iceberg.apache.org/status/) 
marks `variant`
   as supported (`Y`) in the Java library, this refers to the type definition 
layer only.
   The end-to-end support across all catalog backends (especially JDBC catalog) 
is incomplete
   in Iceberg 1.10.1.
   
   ### How should we improve?
   
   1. **Track the upstream Iceberg fix**: Monitor and follow the upstream 
Iceberg issue/PR that
      adds full `variant` type support to the JDBC catalog's schema 
serialization/deserialization
      path. Upgrade Gravitino's Iceberg dependency once the fix is available.
   
   2. **Add a clear error message**: In the interim, Gravitino's Iceberg REST 
Server should
      catch this specific `UnsupportedOperationException` for `variant` type 
and return a more
      descriptive error message to the client, e.g.:
      > "Iceberg V3 `variant` type is not yet fully supported by the JDBC 
catalog backend.


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