This is an automated email from the ASF dual-hosted git repository.
timbrown pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-xtable.git
The following commit(s) were added to refs/heads/main by this push:
new abbf4b72 fix(iceberg): nested comments with qualified name (#797)
abbf4b72 is described below
commit abbf4b72a0910719246de5f81a74777f43b53ecd
Author: Nicolas Paris <[email protected]>
AuthorDate: Sat Feb 21 00:45:10 2026 +0100
fix(iceberg): nested comments with qualified name (#797)
* fix(iceberg): nested comments with qualified name
* add ut
---
.../java/org/apache/xtable/iceberg/IcebergSchemaSync.java | 14 +++++---------
.../org/apache/xtable/iceberg/TestIcebergSchemaSync.java | 6 +++---
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git
a/xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergSchemaSync.java
b/xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergSchemaSync.java
index 4b570560..29f7805b 100644
--- a/xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergSchemaSync.java
+++ b/xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergSchemaSync.java
@@ -125,30 +125,26 @@ public class IcebergSchemaSync {
String parentPath) {
Map<Integer, Supplier<UpdateSchema>> updates = new HashMap<>();
if (!latestColumn.equals(currentColumn)) {
+ String fqName = constructFullyQualifiedName(latestColumn.name(),
parentPath);
// update the type of the column
if (latestColumn.type().isPrimitiveType()
&& !latestColumn.type().equals(currentColumn.type())) {
updates.put(
latestColumn.fieldId(),
- () ->
- updateSchema.updateColumn(
- latestColumn.name(),
latestColumn.type().asPrimitiveType()));
+ () -> updateSchema.updateColumn(fqName,
latestColumn.type().asPrimitiveType()));
}
// update whether the column is required
if (latestColumn.isOptional() != currentColumn.isOptional()) {
if (latestColumn.isOptional()) {
- updates.put(
- latestColumn.fieldId(), () ->
updateSchema.makeColumnOptional(latestColumn.name()));
+ updates.put(latestColumn.fieldId(), () ->
updateSchema.makeColumnOptional(fqName));
} else {
- updates.put(
- latestColumn.fieldId(), () ->
updateSchema.requireColumn(latestColumn.name()));
+ updates.put(latestColumn.fieldId(), () ->
updateSchema.requireColumn(fqName));
}
}
// update the comment of the column
if (!Objects.equals(currentColumn.doc(), latestColumn.doc())) {
updates.put(
- latestColumn.fieldId(),
- () -> updateSchema.updateColumnDoc(latestColumn.name(),
latestColumn.doc()));
+ latestColumn.fieldId(), () -> updateSchema.updateColumnDoc(fqName,
latestColumn.doc()));
}
if (latestColumn.type().isStructType()) {
updates.putAll(
diff --git
a/xtable-core/src/test/java/org/apache/xtable/iceberg/TestIcebergSchemaSync.java
b/xtable-core/src/test/java/org/apache/xtable/iceberg/TestIcebergSchemaSync.java
index ffdd5f99..4b0aca64 100644
---
a/xtable-core/src/test/java/org/apache/xtable/iceberg/TestIcebergSchemaSync.java
+++
b/xtable-core/src/test/java/org/apache/xtable/iceberg/TestIcebergSchemaSync.java
@@ -291,7 +291,7 @@ public class TestIcebergSchemaSync {
schemaSync.sync(SCHEMA, latest, mockTransaction);
- verify(mockUpdateSchema).updateColumnDoc("int_field", "doc");
+ verify(mockUpdateSchema).updateColumnDoc("record.int_field", "doc");
verify(mockUpdateSchema).commit();
}
@@ -312,7 +312,7 @@ public class TestIcebergSchemaSync {
schemaSync.sync(SCHEMA, latest, mockTransaction);
- verify(mockUpdateSchema).updateColumnDoc("element_string", "doc");
+
verify(mockUpdateSchema).updateColumnDoc("array_field.element.element_string",
"doc");
verify(mockUpdateSchema).commit();
}
@@ -336,7 +336,7 @@ public class TestIcebergSchemaSync {
schemaSync.sync(SCHEMA, latest, mockTransaction);
- verify(mockUpdateSchema).updateColumnDoc("value_string", "doc");
+ verify(mockUpdateSchema).updateColumnDoc("map_field.value.value_string",
"doc");
verify(mockUpdateSchema).commit();
}