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 3218285beb [iceberg] Support real uuid for iceberg table (#7136)
3218285beb is described below
commit 3218285beb5d1a2e2f0cdd6b895ae90e45b9a980
Author: jianguotian <[email protected]>
AuthorDate: Wed Jan 28 14:49:52 2026 +0800
[iceberg] Support real uuid for iceberg table (#7136)
---
.../main/java/org/apache/paimon/catalog/CatalogUtils.java | 8 ++++++--
.../java/org/apache/paimon/table/iceberg/IcebergTable.java | 8 +++++++-
.../org/apache/paimon/table/iceberg/IcebergTableImpl.java | 13 +++++++++++--
.../test/java/org/apache/paimon/rest/RESTCatalogTest.java | 2 ++
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java
b/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java
index f970934348..1dd9d6d64e 100644
--- a/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java
+++ b/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java
@@ -264,7 +264,7 @@ public class CatalogUtils {
}
if (options.type() == TableType.ICEBERG_TABLE) {
- return toIcebergTable(identifier, schema, dataFileIO);
+ return toIcebergTable(identifier, schema, dataFileIO,
metadata.uuid());
}
Identifier tableIdentifier = identifier;
@@ -443,7 +443,10 @@ public class CatalogUtils {
}
private static IcebergTable toIcebergTable(
- Identifier identifier, TableSchema schema, Function<Path, FileIO>
fileIO) {
+ Identifier identifier,
+ TableSchema schema,
+ Function<Path, FileIO> fileIO,
+ @Nullable String uuid) {
Map<String, String> options = schema.options();
String location = options.get(CoreOptions.PATH.key());
return IcebergTable.builder()
@@ -454,6 +457,7 @@ public class CatalogUtils {
.partitionKeys(schema.partitionKeys())
.options(options)
.comment(schema.comment())
+ .uuid(uuid)
.build();
}
}
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTable.java
b/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTable.java
index 54212ee041..f8c67fc776 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTable.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTable.java
@@ -50,6 +50,7 @@ public interface IcebergTable extends Table {
private String location;
private Map<String, String> options;
private String comment;
+ private String uuid;
public Builder identifier(Identifier identifier) {
this.identifier = identifier;
@@ -86,9 +87,14 @@ public interface IcebergTable extends Table {
return this;
}
+ public Builder uuid(String uuid) {
+ this.uuid = uuid;
+ return this;
+ }
+
public IcebergTable build() {
return new IcebergTableImpl(
- identifier, fileIO, rowType, partitionKeys, location,
options, comment);
+ identifier, fileIO, rowType, partitionKeys, location,
options, comment, uuid);
}
}
}
diff --git
a/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTableImpl.java
b/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTableImpl.java
index 178c59a3ba..b4fe7c405d 100644
---
a/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTableImpl.java
+++
b/paimon-core/src/main/java/org/apache/paimon/table/iceberg/IcebergTableImpl.java
@@ -25,6 +25,7 @@ import org.apache.paimon.table.ReadonlyTable;
import org.apache.paimon.table.source.InnerTableRead;
import org.apache.paimon.table.source.InnerTableScan;
import org.apache.paimon.types.RowType;
+import org.apache.paimon.utils.StringUtils;
import javax.annotation.Nullable;
@@ -44,6 +45,7 @@ public class IcebergTableImpl implements ReadonlyTable,
IcebergTable {
private final String location;
private final Map<String, String> options;
@Nullable private final String comment;
+ @Nullable private final String uuid;
public IcebergTableImpl(
Identifier identifier,
@@ -52,7 +54,8 @@ public class IcebergTableImpl implements ReadonlyTable,
IcebergTable {
List<String> partitionKeys,
String location,
Map<String, String> options,
- @Nullable String comment) {
+ @Nullable String comment,
+ @Nullable String uuid) {
this.identifier = identifier;
this.fileIO = fileIO;
this.rowType = rowType;
@@ -60,6 +63,7 @@ public class IcebergTableImpl implements ReadonlyTable,
IcebergTable {
this.location = location;
this.options = options;
this.comment = comment;
+ this.uuid = uuid;
}
@Override
@@ -72,6 +76,11 @@ public class IcebergTableImpl implements ReadonlyTable,
IcebergTable {
return identifier.getFullName();
}
+ @Override
+ public String uuid() {
+ return StringUtils.isEmpty(uuid) ? fullName() : uuid;
+ }
+
@Override
public RowType rowType() {
return rowType;
@@ -117,7 +126,7 @@ public class IcebergTableImpl implements ReadonlyTable,
IcebergTable {
Map<String, String> newOptions = new HashMap<>(options);
newOptions.putAll(dynamicOptions);
return new IcebergTableImpl(
- identifier, fileIO, rowType, partitionKeys, location,
newOptions, comment);
+ identifier, fileIO, rowType, partitionKeys, location,
newOptions, comment, uuid);
}
@Override
diff --git
a/paimon-core/src/test/java/org/apache/paimon/rest/RESTCatalogTest.java
b/paimon-core/src/test/java/org/apache/paimon/rest/RESTCatalogTest.java
index 81025f2405..f18c4752ab 100644
--- a/paimon-core/src/test/java/org/apache/paimon/rest/RESTCatalogTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/rest/RESTCatalogTest.java
@@ -2585,6 +2585,8 @@ public abstract class RESTCatalogTest extends
CatalogTestBase {
assertThat(table.partitionKeys()).containsExactly("pt");
assertThat(table.fileIO()).isInstanceOf(RESTTokenFileIO.class);
assertThat(tables).containsExactlyInAnyOrder("table1");
+ assertThat(table.uuid()).isNotEmpty();
+ assertThat(table.uuid()).isNotEqualTo(table.fullName());
}
@Test