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 fff82b93ff [core] Pack disjoint ranges during deletion vector
materialization (#11201)
fff82b93ff is described below
commit fff82b93ff3f87c0a7c5c9a9f2f98ad86787628e
Author: zhoulii <[email protected]>
AuthorDate: Mon Nov 16 23:10:59 2026 +0800
[core] Pack disjoint ranges during deletion vector materialization (#11201)
---
.../data-evolution-maintenance.mdx | 4 ++
...lutionDeletionVectorMaterializeCoordinator.java | 22 +---------
.../table/DataEvolutionDeletionVectorTest.java | 48 ++++++++++++++++++++++
3 files changed, 54 insertions(+), 20 deletions(-)
diff --git a/docs/docs/multimodal-table/data-evolution-maintenance.mdx
b/docs/docs/multimodal-table/data-evolution-maintenance.mdx
index 69164a89d6..65788a13ba 100644
--- a/docs/docs/multimodal-table/data-evolution-maintenance.mdx
+++ b/docs/docs/multimodal-table/data-evolution-maintenance.mdx
@@ -228,6 +228,10 @@ rewrites the surviving data, assigns new row IDs, removes
the applied deletion
vectors, and drops affected global indexes. Concurrent changes to the affected
row-ID ranges cause the operation to fail instead of committing stale results.
+Within each batch, complete selected row-ID components from the same partition
+are packed by estimated surviving size, even across gaps in the old row IDs.
+Independent ranges without deletion vectors remain untouched.
+
For a partitioned table, select partitions by either `partitions` or a
partition predicate in `where`; they cannot be used together. These alternative
examples assume an existing `default.partitioned_table` with an integer
partition
diff --git
a/paimon-core/src/main/java/org/apache/paimon/append/dataevolution/DataEvolutionDeletionVectorMaterializeCoordinator.java
b/paimon-core/src/main/java/org/apache/paimon/append/dataevolution/DataEvolutionDeletionVectorMaterializeCoordinator.java
index 2df7530982..69b7771ad0 100644
---
a/paimon-core/src/main/java/org/apache/paimon/append/dataevolution/DataEvolutionDeletionVectorMaterializeCoordinator.java
+++
b/paimon-core/src/main/java/org/apache/paimon/append/dataevolution/DataEvolutionDeletionVectorMaterializeCoordinator.java
@@ -429,15 +429,9 @@ public class
DataEvolutionDeletionVectorMaterializeCoordinator {
List<List<DataFileMeta>> components =
rangeHelper.mergeOverlappingRanges(partitionFiles.getValue());
MaterializeBin bin = new MaterializeBin(targetFileSize);
- long previousEnd = Long.MIN_VALUE;
+ // Materialization assigns new row IDs, so gaps between
complete components
+ // do not need to end a bin.
for (List<DataFileMeta> component : components) {
- Range componentRange = componentRange(component);
- if (!bin.isEmpty()
- && previousEnd != Long.MAX_VALUE
- && componentRange.from > previousEnd + 1) {
- addTask(tasks, bin.drain(), partition, deletionFiles);
- }
-
long weight = componentWeight(component, deletionFiles);
if (weight > targetFileSize) {
addTask(tasks, bin.drain(), partition, deletionFiles);
@@ -455,7 +449,6 @@ public class
DataEvolutionDeletionVectorMaterializeCoordinator {
addTask(tasks, bin.drain(), partition,
deletionFiles);
}
}
- previousEnd = componentRange.to;
}
addTask(tasks, bin.drain(), partition, deletionFiles);
}
@@ -527,17 +520,6 @@ public class
DataEvolutionDeletionVectorMaterializeCoordinator {
return new
RangeHelper<DataFileMeta>(DataFileMeta::nonNullRowIdRange)
.mergeOverlappingRanges(normalFiles);
}
-
- private Range componentRange(List<DataFileMeta> component) {
- long min = Long.MAX_VALUE;
- long max = Long.MIN_VALUE;
- for (DataFileMeta file : component) {
- Range range = file.nonNullRowIdRange();
- min = Math.min(min, range.from);
- max = Math.max(max, range.to);
- }
- return new Range(min, max);
- }
}
private static class MaterializeBin {
diff --git
a/paimon-core/src/test/java/org/apache/paimon/table/DataEvolutionDeletionVectorTest.java
b/paimon-core/src/test/java/org/apache/paimon/table/DataEvolutionDeletionVectorTest.java
index 1d25059c1e..cdadc6dbf1 100644
---
a/paimon-core/src/test/java/org/apache/paimon/table/DataEvolutionDeletionVectorTest.java
+++
b/paimon-core/src/test/java/org/apache/paimon/table/DataEvolutionDeletionVectorTest.java
@@ -1152,6 +1152,54 @@ public class DataEvolutionDeletionVectorTest extends
DataEvolutionTestBase {
assertThat(liveDeletionVectorDataFileNames(table)).isEmpty();
}
+ @Test
+ public void testMaterializePacksRangesAcrossUnchangedRange() throws
Exception {
+ createTableDefault();
+ FileStoreTable table = getTableDefault();
+ writeBaseRows(table);
+ updateStructuredColumn(table);
+ commitDeletionVectors(
+ table,
+ Arrays.asList(
+ new DvSpec(new Range(0, 4), 1, 4), new DvSpec(new
Range(10, 14), 10, 12)));
+ Map<Range, List<DataFileMeta>> filesBefore = normalFilesByRange(table);
+
+ materializeDeletionVectors(table);
+
+ Map<Range, List<DataFileMeta>> filesAfter = normalFilesByRange(table);
+ assertThat(filesAfter.keySet())
+ .containsExactlyInAnyOrder(new Range(5, 9), new Range(15, 20));
+ assertThat(filesAfter.get(new Range(15, 20))).hasSize(1);
+ assertThat(fileNames(filesAfter.get(new Range(5, 9))))
+ .isEqualTo(fileNames(filesBefore.get(new Range(5, 9))));
+ assertThat(readRows(table.newReadBuilder()))
+ .containsExactlyElementsOf(
+ expectedRowsExcluding("updated", FULL_RANGE, 1, 4, 10,
12));
+ assertThat(liveDeletionVectorDataFileNames(table)).isEmpty();
+ }
+
+ @Test
+ public void testMaterializeDisjointRangesRespectTargetSize() throws
Exception {
+ createTableDefault();
+ FileStoreTable table = getTableDefault();
+ writeBaseRows(table);
+ commitDeletionVectors(
+ table,
+ Arrays.asList(new DvSpec(new Range(0, 4), 1), new DvSpec(new
Range(10, 14), 12)));
+ table =
table.copy(Collections.singletonMap(CoreOptions.TARGET_FILE_SIZE.key(), "1 b"));
+
+ List<DataEvolutionCompactTask> tasks =
+ new DataEvolutionDeletionVectorMaterializeCoordinator(
+ table, null, table.latestSnapshot().get())
+ .plan();
+
+ assertThat(tasks).hasSize(2);
+ assertThat(normalFileRowRanges(tasks.get(0).compactBefore()))
+ .containsExactly(new Range(0, 4));
+ assertThat(normalFileRowRanges(tasks.get(1).compactBefore()))
+ .containsExactly(new Range(10, 14));
+ }
+
@Test
public void testMaterializeRangeCoveredBySpanningBlobFile() throws
Exception {
createTableDefault();