danhuawang opened a new issue, #11606:
URL: https://github.com/apache/gravitino/issues/11606
### Version
main branch
### Describe what's wrong
When using the Gravitino Flink Iceberg connector to write data (`INSERT
INTO`) to an Iceberg table with `catalog-backend=hive`, the commit phase fails
with `NoSuchMethodError:
'org.apache.iceberg.shaded.com.fasterxml.jackson.databind.ObjectMapper
org.apache.iceberg.util.JsonUtil.mapper()'`.
Root cause: The Flink client classpath contains both `iceberg-flink-runtime`
(shaded fat jar, version depending on Flink — e.g. 1.9.2 for Flink 1.18, 1.10.2
for Flink 1.19) and `iceberg-hive-metastore` 1.11.0 (non-shaded, pulled from
Gravitino's main Iceberg dependency). `HMSTablePropertyHelper` (new in Iceberg
1.11) calls `JsonUtil.mapper()` expecting the 1.11 shaded `ObjectMapper` return
type, but the classloader resolves `JsonUtil` from the older
`iceberg-flink-runtime` jar where that method signature doesn't exist or
returns a different type.
The Flink connector uses Hive backend in "client-direct" mode —
`IcebergFilesCommitter` commits directly to Hive Metastore from the Flink task,
so the conflict happens entirely on the client side.
### Error message and/or stacktrace
```
java.lang.NoSuchMethodError:
'org.apache.iceberg.shaded.com.fasterxml.jackson.databind.ObjectMapper
org.apache.iceberg.util.JsonUtil.mapper()'
at
org.apache.iceberg.hive.HMSTablePropertyHelper.setSnapshotSummary(HMSTablePropertyHelper.java:223)
at
org.apache.iceberg.hive.HMSTablePropertyHelper.setSnapshotStats(HMSTablePropertyHelper.java:213)
at
org.apache.iceberg.hive.HMSTablePropertyHelper.updateHmsTableForIcebergTable(HMSTablePropertyHelper.java:125)
at
org.apache.iceberg.hive.HiveTableOperations.doCommit(HiveTableOperations.java:331)
at
org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:127)
at
org.apache.iceberg.SnapshotProducer.lambda$commit$2(SnapshotProducer.java:501)
...
at
org.apache.iceberg.flink.sink.IcebergFilesCommitter.commitOperation(IcebergFilesCommitter.java:415)
at
org.apache.iceberg.flink.sink.IcebergFilesCommitter.endInput(IcebergFilesCommitter.java:441)
```
### How to reproduce
1. Deploy Gravitino server (main branch) with Iceberg catalog
`catalog-backend=hive` pointing to a Hive Metastore.
2. Use Gravitino Flink connector (Flink 1.18 or 1.19) with Gravitino catalog
store to connect to the Iceberg Hive backend catalog.
3. Create a table and insert data:
```sql
CREATE TABLE orders (id INT, name STRING);
INSERT INTO orders VALUES (1, 'alice'), (2, 'bob');
```
4. The INSERT fails at commit time with `NoSuchMethodError`.
Note: `CREATE TABLE` and `CREATE VIEW` succeed (they only require DDL on the
server side). Only DML write operations (INSERT/MERGE) that need the Flink
client to commit to Hive Metastore directly are affected.
### Additional context
Iceberg version matrix in Gravitino:
```
Server/catalog: iceberg = 1.11.0
Flink 1.18: iceberg4flink18 = 1.9.2
Flink 1.19: iceberg4flink119 = 1.10.2
Flink 1.20: iceberg4flink120 = 1.11.0 (this version should work)
```
The conflict arises because:
- `iceberg-flink-runtime-1.18-1.9.2.jar` (shaded) contains `JsonUtil` from
Iceberg 1.9.2
- `iceberg-hive-metastore-1.11.0.jar` (non-shaded) contains
`HMSTablePropertyHelper` from 1.11.0
- `HMSTablePropertyHelper.setSnapshotSummary()` calls `JsonUtil.mapper()`
expecting the 1.11 signature with shaded Jackson return type, but gets the
1.9.2 `JsonUtil`
Flink 1.20 (which uses `iceberg4flink120 = 1.11.0`) may not hit this issue
since versions align. The bug primarily affects Flink 1.18 and Flink 1.19 users.
Possible fixes:
1. Ensure `iceberg-hive-metastore` version on client classpath matches
`iceberg-flink-runtime` version (not server version).
2. For Hive backend, route commits through Gravitino REST instead of
client-direct HMS commit (eliminating client-side Iceberg Hive catalog code
entirely).
--
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]