This is an automated email from the ASF dual-hosted git repository.
JingsongLi 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 513966a479 [core] Migrate shredding map on rename and drop commands
(#8780)
513966a479 is described below
commit 513966a479cd7f72e23adcc7ef4a7ebe7c68a7be
Author: Arnav Balyan <[email protected]>
AuthorDate: Thu Jul 23 16:11:17 2026 +0530
[core] Migrate shredding map on rename and drop commands (#8780)
---
.../apache/paimon/schema/ColumnDirectiveUtils.java | 19 +++++++++++
.../org/apache/paimon/schema/SchemaManager.java | 18 +++++++++-
.../paimon/table/MapSharedShreddingTableTest.java | 38 ++++++++++++++++++++++
3 files changed, 74 insertions(+), 1 deletion(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/schema/ColumnDirectiveUtils.java
b/paimon-core/src/main/java/org/apache/paimon/schema/ColumnDirectiveUtils.java
index b5bd10d76b..d94f70f9de 100644
---
a/paimon-core/src/main/java/org/apache/paimon/schema/ColumnDirectiveUtils.java
+++
b/paimon-core/src/main/java/org/apache/paimon/schema/ColumnDirectiveUtils.java
@@ -345,6 +345,25 @@ public final class ColumnDirectiveUtils {
}
}
options.remove(String.format("field.%s.vector-dim", fieldName));
+ } else if (type.getTypeRoot() == DataTypeRoot.MAP) {
+ options.remove(
+ CoreOptions.FIELDS_PREFIX
+ + "."
+ + fieldName
+ + "."
+ + CoreOptions.MAP_STORAGE_LAYOUT);
+ options.remove(
+ CoreOptions.FIELDS_PREFIX
+ + "."
+ + fieldName
+ + "."
+ + CoreOptions.MAP_SHARED_SHREDDING_MAX_COLUMNS);
+ options.remove(
+ CoreOptions.FIELDS_PREFIX
+ + "."
+ + fieldName
+ + "."
+ +
CoreOptions.MAP_SHARED_SHREDDING_COLUMN_PLACEMENT_POLICY);
}
}
diff --git
a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java
b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java
index c9c1a6b5f5..4c238781b9 100644
--- a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java
+++ b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java
@@ -94,6 +94,9 @@ import static org.apache.paimon.CoreOptions.IGNORE_DELETE;
import static org.apache.paimon.CoreOptions.IGNORE_RETRACT;
import static org.apache.paimon.CoreOptions.IGNORE_UPDATE_BEFORE;
import static org.apache.paimon.CoreOptions.LIST_AGG_DELIMITER;
+import static
org.apache.paimon.CoreOptions.MAP_SHARED_SHREDDING_COLUMN_PLACEMENT_POLICY;
+import static org.apache.paimon.CoreOptions.MAP_SHARED_SHREDDING_MAX_COLUMNS;
+import static org.apache.paimon.CoreOptions.MAP_STORAGE_LAYOUT;
import static org.apache.paimon.CoreOptions.NESTED_KEY;
import static org.apache.paimon.CoreOptions.PK_CLUSTERING_OVERRIDE;
import static org.apache.paimon.CoreOptions.SEQUENCE_FIELD;
@@ -854,7 +857,20 @@ public class SchemaManager implements Serializable {
fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
AGG_FUNCTION,
fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
IGNORE_RETRACT,
fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
DISTINCT,
- fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
LIST_AGG_DELIMITER);
+ fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
LIST_AGG_DELIMITER,
+ fieldName -> FIELDS_PREFIX + "." + fieldName + "." +
MAP_STORAGE_LAYOUT,
+ fieldName ->
+ FIELDS_PREFIX
+ + "."
+ + fieldName
+ + "."
+ + MAP_SHARED_SHREDDING_MAX_COLUMNS,
+ fieldName ->
+ FIELDS_PREFIX
+ + "."
+ + fieldName
+ + "."
+ +
MAP_SHARED_SHREDDING_COLUMN_PLACEMENT_POLICY);
for (RenameColumn rename : renameColumns) {
String fieldName = rename.fieldNames()[0];
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/MapSharedShreddingTableTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/MapSharedShreddingTableTest.java
index 35e86d9a1d..666654231b 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/MapSharedShreddingTableTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/MapSharedShreddingTableTest.java
@@ -947,6 +947,44 @@ public class MapSharedShreddingTableTest extends
TableTestBase {
}
}
+ @ParameterizedTest
+ @ValueSource(strings = {"orc", "parquet"})
+ public void testRenameSharedShreddingMapColumn(String format) throws
Exception {
+ createTable(format, 2, "metrics");
+
+ catalog.alterTable(
+ identifier(format),
+ Collections.singletonList(SchemaChange.renameColumn("metrics",
"renamed_metrics")),
+ false);
+
+ Table table = catalog.getTable(identifier(format));
+ assertThat(table.rowType().getFieldNames()).containsExactly("id",
"renamed_metrics");
+
+ Map<String, String> options = table.options();
+
assertThat(options).doesNotContainKey("fields.metrics.map.storage-layout");
+ assertThat(options)
+ .containsEntry("fields.renamed_metrics.map.storage-layout",
"shared-shredding")
+
.containsEntry("fields.renamed_metrics.map.shared-shredding.max-columns", "2");
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = {"orc", "parquet"})
+ public void testDropSharedShreddingMapColumn(String format) throws
Exception {
+ createTable(format, 2, "metrics", "labels");
+
+ catalog.alterTable(
+ identifier(format),
+ Collections.singletonList(SchemaChange.dropColumn("metrics")),
+ false);
+
+ Table table = catalog.getTable(identifier(format));
+ assertThat(table.rowType().getFieldNames()).containsExactly("id",
"labels");
+
+ Map<String, String> options = table.options();
+
assertThat(options).doesNotContainKey("fields.metrics.map.storage-layout");
+
assertThat(options).doesNotContainKey("fields.metrics.map.shared-shredding.max-columns");
+ }
+
private Table createTable(String format, String... sharedShreddingFields)
throws Exception {
return createTable(format, 2, sharedShreddingFields);
}