This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 65f2b731f0 [iceberg] Refactored schema ID retrieval to use latest
schema (#5701)
65f2b731f0 is described below
commit 65f2b731f0268f37077913db56b7de5edb716cb4
Author: 0dunay0 <[email protected]>
AuthorDate: Fri Jun 6 08:57:55 2025 +0100
[iceberg] Refactored schema ID retrieval to use latest schema (#5701)
---
.../java/org/apache/paimon/iceberg/IcebergCommitCallback.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/iceberg/IcebergCommitCallback.java
b/paimon-core/src/main/java/org/apache/paimon/iceberg/IcebergCommitCallback.java
index 053e6206f1..9e11b8f2ee 100644
---
a/paimon-core/src/main/java/org/apache/paimon/iceberg/IcebergCommitCallback.java
+++
b/paimon-core/src/main/java/org/apache/paimon/iceberg/IcebergCommitCallback.java
@@ -328,7 +328,7 @@ public class IcebergCommitCallback implements
CommitCallback, TagCallback {
String manifestListFileName =
manifestList.writeWithoutRolling(manifestFileMetas);
- int schemaId = (int) table.schema().id();
+ int schemaId = (int) schemaCache.getLatestSchemaId();
IcebergSchema icebergSchema = schemaCache.get(schemaId);
List<IcebergPartitionField> partitionFields =
getPartitionFields(table.schema().partitionKeys(),
icebergSchema);
@@ -559,7 +559,7 @@ public class IcebergCommitCallback implements
CommitCallback, TagCallback {
// add new schema if needed
SchemaCache schemaCache = new SchemaCache();
- int schemaId = (int) table.schema().id();
+ int schemaId = (int) schemaCache.getLatestSchemaId();
IcebergSchema icebergSchema = schemaCache.get(schemaId);
List<IcebergSchema> schemas = baseMetadata.schemas();
if (baseMetadata.currentSchemaId() != schemaId) {
@@ -1189,5 +1189,9 @@ public class IcebergCommitCallback implements
CommitCallback, TagCallback {
return schemas.computeIfAbsent(
schemaId, id ->
IcebergSchema.create(schemaManager.schema(id)));
}
+
+ private long getLatestSchemaId() {
+ return schemaManager.latest().get().id();
+ }
}
}