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 b25c93dcae [core] Opt-in range pruning for contiguous DV deletions in 
Data Evolution scans (#11214)
b25c93dcae is described below

commit b25c93dcae6be762f4ed1b5d20aee6086d787822
Author: sanshi <[email protected]>
AuthorDate: Tue Nov 17 13:37:06 2026 +0800

    [core] Opt-in range pruning for contiguous DV deletions in Data Evolution 
scans (#11214)
---
 docs/generated/core_configuration.html             |   6 +
 .../main/java/org/apache/paimon/CoreOptions.java   |  19 ++
 .../paimon/operation/DataEvolutionSplitRead.java   | 123 ++++++++-
 .../operation/DataEvolutionSplitReadTest.java      | 301 +++++++++++++++++++++
 4 files changed, 446 insertions(+), 3 deletions(-)

diff --git a/docs/generated/core_configuration.html 
b/docs/generated/core_configuration.html
index 67e06edf25..46a3327c1e 100644
--- a/docs/generated/core_configuration.html
+++ b/docs/generated/core_configuration.html
@@ -554,6 +554,12 @@ under the License.
             <td>Boolean</td>
             <td>Whether data-evolution compaction selects normal data files 
larger than data-evolution.compaction.large-file-ratio times target-file-size, 
even below compaction.min.file-num when dedicated-file ranges allow splitting. 
Normal output ranges are estimated from input file sizes and row counts toward 
target-file-size, then adjusted to avoid cutting through any BLOB or VECTOR 
file range. Actual output sizes may differ from the target. Row IDs and logical 
deletions are preserved [...]
         </tr>
+        <tr>
+            <td><h5>data-evolution.data-file-dv-pushdown.enabled</h5></td>
+            <td style="word-wrap: break-word;">false</td>
+            <td>Boolean</td>
+            <td>Whether to prune a contiguous deletion span from data file 
reads. When the deletions of a Parquet data file form one contiguous span of 
physical rows covering at least half of the file, the scan skips that span and 
reads the remaining rows as ranges. This applies only when the scan has no 
other row-range or file-index selection; scattered deletions also keep the 
regular read path. The deletion vector is still applied on top, so results 
never change.</td>
+        </tr>
         <tr>
             <td><h5>data-evolution.enabled</h5></td>
             <td style="word-wrap: break-word;">false</td>
diff --git a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java 
b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
index 01074dd578..3886267fce 100644
--- a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
+++ b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
@@ -2764,6 +2764,21 @@ public class CoreOptions implements Serializable {
                                     + "selected row count is no more than "
                                     + 
"data-evolution.row-sidecar.max-selected-rows.");
 
+    public static final ConfigOption<Boolean> 
DATA_EVOLUTION_DATA_FILE_DV_PUSHDOWN_ENABLED =
+            key("data-evolution.data-file-dv-pushdown.enabled")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to prune a contiguous deletion span from 
data file reads. "
+                                    + "When the deletions of a Parquet data 
file form one "
+                                    + "contiguous span of physical rows 
covering at least half "
+                                    + "of the file, the scan skips that span 
and reads the "
+                                    + "remaining rows as ranges. This applies 
only when the "
+                                    + "scan has no other row-range or 
file-index selection; "
+                                    + "scattered deletions also keep the 
regular read path. "
+                                    + "The deletion vector is still applied on 
top, so results "
+                                    + "never change.");
+
     public static final ConfigOption<Boolean> 
DATA_EVOLUTION_MERGED_READ_STATS_PUSHDOWN_ENABLED =
             key("data-evolution.merged-read.stats-pushdown.enabled")
                     .booleanType()
@@ -4819,6 +4834,10 @@ public class CoreOptions implements Serializable {
         return maxSelectionRatio;
     }
 
+    public boolean dataEvolutionDataFileDvPushdownEnabled() {
+        return options.get(DATA_EVOLUTION_DATA_FILE_DV_PUSHDOWN_ENABLED);
+    }
+
     public boolean dataEvolutionMergeIntoFilePruning() {
         return options.get(DATA_EVOLUTION_MERGE_INTO_FILE_PRUNING);
     }
diff --git 
a/paimon-core/src/main/java/org/apache/paimon/operation/DataEvolutionSplitRead.java
 
b/paimon-core/src/main/java/org/apache/paimon/operation/DataEvolutionSplitRead.java
index c6135941dd..361fd14fce 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/operation/DataEvolutionSplitRead.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/operation/DataEvolutionSplitRead.java
@@ -130,6 +130,9 @@ public class DataEvolutionSplitRead implements 
SplitRead<InternalRow> {
 
     private static final String ROW_SIDECAR_FORMAT = "row";
 
+    /** Minimum share of a file's rows that a contiguous deletion span must 
cover to prune it. */
+    private static final double DATA_FILE_DV_MIN_DELETED_RATIO = 0.5d;
+
     private final FileIO fileIO;
     private final TableSchema schema;
     private final FileFormatDiscover formatDiscover;
@@ -957,8 +960,10 @@ public class DataEvolutionSplitRead implements 
SplitRead<InternalRow> {
                         ? (BitmapIndexResult) fileIndexResult
                         : null;
         if (selection != null && selection.isEmpty()) {
-            // Data-file targets never include DV-only filtering in their 
selection, so a file
-            // fully deleted by its DV still reaches applyDeletionVector below.
+            // With data-evolution.data-file-dv-pushdown.enabled, a fully 
deleted file whose
+            // deletions form one contiguous span yields an empty selection 
here. Otherwise
+            // data-file targets never include DV-only filtering, so a fully 
deleted file still
+            // reaches applyDeletionVector below.
             return new EmptyFileRecordReader<>();
         }
 
@@ -1575,11 +1580,26 @@ public class DataEvolutionSplitRead implements 
SplitRead<InternalRow> {
                 }
             }
         }
+        RoaringBitmap32 dataFileSelection = selection;
+        if (selection == null
+                && deletionVector != null
+                && coreOptions.dataEvolutionDataFileDvPushdownEnabled()
+                && isParquetDataFile(file)) {
+            RoaringBitmap32 liveSelection =
+                    contiguousDeletionLiveSelection(
+                            file,
+                            deletionVector.deletionVector,
+                            deletionVector.range,
+                            DATA_FILE_DV_MIN_DELETED_RATIO);
+            if (liveSelection != null) {
+                dataFileSelection = liveSelection;
+            }
+        }
         return new FileReadTarget(
                 DataFilePathFactory.formatIdentifier(file.fileName()),
                 dataFilePathFactory.toPath(file),
                 file.fileSize(),
-                selection);
+                dataFileSelection);
     }
 
     @VisibleForTesting
@@ -1723,6 +1743,103 @@ public class DataEvolutionSplitRead implements 
SplitRead<InternalRow> {
         return deleted;
     }
 
+    /**
+     * Returns the live-row selection when the deletion vector's in-file 
positions form exactly one
+     * contiguous span covering at least {@code minDeletedRatio} of the file's 
rows, so the reader
+     * can skip that span. The deletion vector is still applied on top of the 
returned selection.
+     * Returns null when the deletions do not qualify (scattered, sparse, or 
misaligned), leaving
+     * the regular read-then-filter path in place. Returns null when no 
pushdown applies, but an
+     * empty bitmap (never null) when the whole file is deleted: null means 
"fall back", empty means
+     * "skip the file".
+     */
+    @Nullable
+    @VisibleForTesting
+    static RoaringBitmap32 contiguousDeletionLiveSelection(
+            DataFileMeta file,
+            @Nullable DeletionVector deletionVector,
+            @Nullable Range deletionVectorRange,
+            double minDeletedRatio) {
+        if (deletionVector == null || deletionVector.isEmpty()) {
+            return null;
+        }
+        long rowCount = file.rowCount();
+        if (rowCount <= 0 || rowCount > RoaringBitmap32.MAX_VALUE) {
+            return null;
+        }
+        long minDeletedRows = (long) Math.ceil(minDeletedRatio * (double) 
rowCount);
+        if (deletionVector.getCardinality() < minDeletedRows) {
+            // O(1) pre-check: too few deletions to ever qualify, skip the 
scan entirely.
+            return null;
+        }
+        long rangeStart =
+                deletionVectorRange == null ? file.nonNullFirstRowId() : 
deletionVectorRange.from;
+        if (file.nonNullFirstRowId() - rangeStart != 0) {
+            // Deletion positions are not file-local (a non-anchor file of a 
merged group).
+            return null;
+        }
+        if (deletionVector instanceof BitmapDeletionVector) {
+            // Fast path: when the whole bitmap lies inside this file, its 
first/last positions
+            // and cardinality decide contiguity without visiting every 
deleted position.
+            // Bitmap64DeletionVector exposes no range summary, so it keeps 
the scan below.
+            RoaringBitmap32 deleted = ((BitmapDeletionVector) 
deletionVector).get();
+            if (deleted.last() < rowCount) {
+                return contiguousSpanSelection(
+                        deleted.getCardinality(),
+                        deleted.first(),
+                        deleted.last(),
+                        rowCount,
+                        minDeletedRows);
+            }
+        }
+        long[] stats = {0L, Long.MAX_VALUE, Long.MIN_VALUE}; // count, min 
position, max position
+        deletionVector.forEachDeletedPosition(
+                position -> {
+                    if (position >= 0 && position < rowCount) {
+                        stats[0]++;
+                        if (position < stats[1]) {
+                            stats[1] = position;
+                        }
+                        if (position > stats[2]) {
+                            stats[2] = position;
+                        }
+                    }
+                });
+        return contiguousSpanSelection(stats[0], stats[1], stats[2], rowCount, 
minDeletedRows);
+    }
+
+    private static RoaringBitmap32 contiguousSpanSelection(
+            long deletedCount, long min, long max, long rowCount, long 
minDeletedRows) {
+        if (deletedCount == 0 || deletedCount < minDeletedRows) {
+            return null;
+        }
+        if (deletedCount != max - min + 1) {
+            // Holes inside the span would drop live rows if the span were 
skipped. This proves
+            // absence of holes only because deletion positions are distinct — 
both DeletionVector
+            // implementations are backed by bitmaps; a non-distinct 
implementation would need a
+            // different check.
+            return null;
+        }
+        if (min == 0 && max == rowCount - 1) {
+            return new RoaringBitmap32();
+        }
+        if (min == 0) {
+            return RoaringBitmap32.bitmapOfRange(max + 1L, rowCount);
+        }
+        if (max == rowCount - 1) {
+            return RoaringBitmap32.bitmapOfRange(0L, min);
+        }
+        return RoaringBitmap32.or(
+                RoaringBitmap32.bitmapOfRange(0L, min),
+                RoaringBitmap32.bitmapOfRange(max + 1L, rowCount));
+    }
+
+    private static boolean isParquetDataFile(DataFileMeta file) {
+        String fileName = file.fileName();
+        return !isBlobFile(fileName)
+                && !isVectorStoreFile(fileName)
+                && 
"parquet".equals(DataFilePathFactory.formatIdentifier(fileName));
+    }
+
     private static boolean isRowSidecarFile(String fileName) {
         try {
             return 
ROW_SIDECAR_FORMAT.equals(DataFilePathFactory.formatIdentifier(fileName));
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/operation/DataEvolutionSplitReadTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/operation/DataEvolutionSplitReadTest.java
index 8e29490970..5abb5c0db5 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/operation/DataEvolutionSplitReadTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/operation/DataEvolutionSplitReadTest.java
@@ -535,6 +535,307 @@ class DataEvolutionSplitReadTest {
                         + ".");
     }
 
+    @Test
+    public void testContiguousDeletionLiveSelection() {
+        DataFileMeta file = createFile("file1.parquet", 0L, 100, 1);
+        Range range = new Range(0L, 99L);
+
+        // prefix deletion [0, 50): live suffix
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(50L, 100L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 50), range, 0.25d));
+        // in-file prefix plus positions outside the file: only in-file 
positions count
+        BitmapDeletionVector mixed = deletionVector(0, 50);
+        for (int position = 200; position < 250; position++) {
+            mixed.delete(position);
+        }
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(50L, 100L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(file, 
mixed, range, 0.25d));
+        // suffix deletion [70, 100): live prefix (30 deleted >= 25% ratio)
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(0L, 70L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(70, 100), range, 0.25d));
+        // middle deletion [20, 50): two live runs (30 deleted >= 25% ratio)
+        assertEquals(
+                RoaringBitmap32.or(
+                        RoaringBitmap32.bitmapOfRange(0L, 20L),
+                        RoaringBitmap32.bitmapOfRange(50L, 100L)),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(20, 50), range, 0.25d));
+        // ratio boundary: exactly 25% deleted is accepted
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(25L, 100L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 25), range, 0.25d));
+        // fully deleted file yields an empty selection
+        assertEquals(
+                new RoaringBitmap32(),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 100), range, 0.25d));
+        // Bitmap64 behaves identically
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(50L, 100L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file,
+                        
Bitmap64DeletionVector.fromBitmapDeletionVector(deletionVector(0, 50)),
+                        range,
+                        0.25d));
+        // null range means file-local positions
+        assertEquals(
+                RoaringBitmap32.bitmapOfRange(50L, 100L),
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 50), null, 0.25d));
+    }
+
+    @Test
+    public void testContiguousDeletionLiveSelectionRejections() {
+        DataFileMeta file = createFile("file1.parquet", 0L, 100, 1);
+        Range range = new Range(0L, 99L);
+
+        // hole inside the span: positions [20, 80) except 50 (59 deleted, 
span is 60)
+        BitmapDeletionVector withHole = deletionVector(20, 50);
+        for (int position = 51; position < 80; position++) {
+            withHole.delete(position);
+        }
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, withHole, range, 0.25d));
+        // scattered deletions: 50 even positions, span is 99
+        BitmapDeletionVector scattered = new BitmapDeletionVector();
+        for (int position = 0; position < 100; position += 2) {
+            scattered.delete(position);
+        }
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, scattered, range, 0.25d));
+        // below the minimum deleted ratio
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 10), range, 0.25d));
+        // empty deletion vector
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, new BitmapDeletionVector(), range, 0.25d));
+        // all positions outside the file
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(100, 150), range, 0.25d));
+        // non-anchor file of a merged group: DV frame is not file-local
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        file, deletionVector(0, 50), new Range(5L, 104L), 
0.25d));
+        // null deletion vector
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(file, 
null, range, 0.25d));
+        // small-file rounding: 1 of 3 rows deleted must not pass a 50% ratio
+        DataFileMeta tinyFile = createFile("tiny.parquet", 0L, 3, 1);
+        assertNull(
+                DataEvolutionSplitRead.contiguousDeletionLiveSelection(
+                        tinyFile, deletionVector(0, 1), new Range(0L, 2L), 
0.5d));
+    }
+
+    @Test
+    public void testDataFileDvPushdownPreservesResults() throws Exception {
+        int rowCount = 10_000;
+
+        // Contiguous deletion of the first 8_000 rows.
+        BitmapDeletionVector contiguous = deletionVector(0, 8_000);
+        List<Integer> expectedContiguous = new ArrayList<>();
+        for (int i = 8_000; i < rowCount; i++) {
+            expectedContiguous.add(1000 + i);
+        }
+
+        // Scattered deletion of 8_000 rows: every position not a multiple of 
5.
+        BitmapDeletionVector scattered = new BitmapDeletionVector();
+        for (int position = 0; position < rowCount; position++) {
+            if (position % 5 != 0) {
+                scattered.delete(position);
+            }
+        }
+        List<Integer> expectedScattered = new ArrayList<>();
+        for (int position = 0; position < rowCount; position += 5) {
+            expectedScattered.add(1000 + position);
+        }
+
+        // A fully deleted contiguous file.
+        BitmapDeletionVector fullyDeleted = deletionVector(0, rowCount);
+
+        // The pushdown must never change results: identical output enabled 
and disabled.
+        long baselineContiguousBytes = 0L;
+        long baselineScatteredBytes = 0L;
+        for (boolean pushdownEnabled : new boolean[] {false, true}) {
+            ScanOutcome contiguousOutcome =
+                    scanWithDeletionVector(
+                            rowCount, contiguous, pushdownEnabled, 
"contiguous", true);
+            ScanOutcome scatteredOutcome =
+                    scanWithDeletionVector(rowCount, scattered, 
pushdownEnabled, "scattered", true);
+            ScanOutcome fullyDeletedOutcome =
+                    scanWithDeletionVector(
+                            rowCount, fullyDeleted, pushdownEnabled, 
"fully-deleted", true);
+
+            assertEquals(expectedContiguous, contiguousOutcome.f0);
+            assertEquals(expectedScattered, scatteredOutcome.f0);
+            // Fully deleted: no rows either way, and zero bytes for BOTH 
settings — with the
+            // default file-index read enabled, the pre-existing 
deletion-vector intersection
+            // skips such files before the pushdown 
(FileIndexEvaluator.intersectDeletionVector).
+            // The loop below disables file-index reading to pin the 
pushdown's own skip.
+            assertEquals(Collections.emptyList(), fullyDeletedOutcome.f0);
+            assertEquals(0L, fullyDeletedOutcome.bytesRead);
+
+            if (pushdownEnabled) {
+                // The contiguous span is pruned: strictly fewer bytes than 
the fallback read.
+                // (The magnitude of the reduction is covered by the 
benchmark, not here.)
+                assertTrue(
+                        contiguousOutcome.bytesRead < baselineContiguousBytes,
+                        "pushdown read "
+                                + contiguousOutcome.bytesRead
+                                + " bytes, baseline read "
+                                + baselineContiguousBytes);
+                // Scattered deletions keep the regular path: identical read 
volume.
+                assertEquals(baselineScatteredBytes, 
scatteredOutcome.bytesRead);
+            } else {
+                baselineContiguousBytes = contiguousOutcome.bytesRead;
+                baselineScatteredBytes = scatteredOutcome.bytesRead;
+            }
+        }
+
+        // With file-index reading disabled, only the pushdown can skip a 
fully deleted
+        // contiguous file: the pushdown-off run must actually read (and 
filter out) the data
+        // file, while the pushdown-on run skips the data file read entirely.
+        for (boolean pushdownEnabled : new boolean[] {false, true}) {
+            ScanOutcome outcome =
+                    scanWithDeletionVector(
+                            rowCount,
+                            fullyDeleted,
+                            pushdownEnabled,
+                            "fully-deleted-no-index",
+                            false);
+            assertEquals(Collections.emptyList(), outcome.f0);
+            if (pushdownEnabled) {
+                assertEquals(0L, outcome.bytesRead);
+            } else {
+                assertTrue(outcome.bytesRead > 0);
+            }
+        }
+    }
+
+    private ScanOutcome scanWithDeletionVector(
+            int rowCount,
+            BitmapDeletionVector deletionVector,
+            boolean pushdownEnabled,
+            String tag,
+            boolean fileIndexReadEnabled)
+            throws Exception {
+        Path tableRoot =
+                new Path(
+                        tempDir.toUri().toString(),
+                        "dv-pushdown-" + (pushdownEnabled ? "on" : "off") + 
"-" + tag);
+        Options options = new Options();
+        options.set(CoreOptions.FILE_FORMAT, "parquet");
+        options.set(CoreOptions.ROW_TRACKING_ENABLED, true);
+        options.set(CoreOptions.DATA_EVOLUTION_ENABLED, true);
+        if (pushdownEnabled) {
+            
options.set(CoreOptions.DATA_EVOLUTION_DATA_FILE_DV_PUSHDOWN_ENABLED, true);
+        }
+        if (!fileIndexReadEnabled) {
+            options.set(CoreOptions.FILE_INDEX_READ_ENABLED, false);
+        }
+        CoreOptions coreOptions = new CoreOptions(options);
+        FileStorePathFactory pathFactory =
+                new FileStorePathFactory(
+                        tableRoot,
+                        RowType.of(),
+                        coreOptions.partitionDefaultName(),
+                        CoreOptions.FILE_FORMAT.defaultValue(),
+                        CoreOptions.DATA_FILE_PREFIX.defaultValue(),
+                        CoreOptions.CHANGELOG_FILE_PREFIX.defaultValue(),
+                        
CoreOptions.PARTITION_GENERATE_LEGACY_NAME.defaultValue(),
+                        
CoreOptions.FILE_SUFFIX_INCLUDE_COMPRESSION.defaultValue(),
+                        CoreOptions.FILE_COMPRESSION.defaultValue(),
+                        null,
+                        null,
+                        CoreOptions.ExternalPathStrategy.NONE,
+                        null,
+                        false,
+                        null);
+        Schema schema =
+                Schema.newBuilder()
+                        .column("f0", DataTypes.INT())
+                        .column("f1", DataTypes.ARRAY(DataTypes.INT()))
+                        .option(CoreOptions.ROW_TRACKING_ENABLED.key(), "true")
+                        .option(CoreOptions.DATA_EVOLUTION_ENABLED.key(), 
"true")
+                        .build();
+        Path bucketPath = pathFactory.bucketPath(EMPTY_ROW, 0);
+        String fileName = "data-0.parquet";
+        Path filePath = new Path(bucketPath, fileName);
+        CountingFileIO fileIO = new CountingFileIO(new LocalFileIO(), 
filePath);
+        SchemaManager schemaManager = new FileSystemSchemaManager(fileIO, 
tableRoot);
+        TableSchema tableSchema = schemaManager.createTable(schema);
+        RowType rowType = tableSchema.logicalRowType();
+
+        fileIO.mkdirs(bucketPath);
+        Options parquetOptions = new Options();
+        parquetOptions.set("parquet.block.size", "65536");
+        parquetOptions.set("parquet.page.size", "4096");
+        parquetOptions.set("parquet.writer.version", "v2");
+        writeNestedParquetFile(fileIO, filePath, rowType, rowCount, 
parquetOptions);
+
+        DataFileMeta dataFile =
+                createFile(fileName, fileIO.getFileStatus(filePath).getLen(), 
0L, rowCount, 1);
+        Path dvPath = new Path(bucketPath, fileName + ".dv");
+        long dvSize;
+        try (PositionOutputStream out = fileIO.newOutputStream(dvPath, false);
+                DataOutputStream dataOutput = new DataOutputStream(out)) {
+            dvSize = deletionVector.serializeTo(dataOutput);
+        }
+        DataSplit split =
+                DataSplit.builder()
+                        .withPartition(EMPTY_ROW)
+                        .withBucket(0)
+                        .withBucketPath(bucketPath.toString())
+                        .withDataFiles(Collections.singletonList(dataFile))
+                        .withDataDeletionFiles(
+                                Collections.singletonList(
+                                        new DeletionFile(
+                                                dvPath.toString(),
+                                                0,
+                                                dvSize,
+                                                
deletionVector.getCardinality())))
+                        .rawConvertible(false)
+                        .build();
+
+        DataEvolutionSplitRead splitRead =
+                new DataEvolutionSplitRead(
+                        fileIO, schemaManager, tableSchema, rowType, 
coreOptions, pathFactory);
+        List<Integer> f0 = new ArrayList<>();
+        try (RecordReader<InternalRow> reader = splitRead.createReader(split)) 
{
+            reader.forEachRemaining(row -> f0.add(row.getInt(0)));
+        }
+        return new ScanOutcome(f0, fileIO.bytesRead());
+    }
+
+    private static final class ScanOutcome {
+
+        private final List<Integer> f0;
+        private final long bytesRead;
+
+        private ScanOutcome(List<Integer> f0, long bytesRead) {
+            this.f0 = f0;
+            this.bytesRead = bytesRead;
+        }
+    }
+
+    private static BitmapDeletionVector deletionVector(int fromInclusive, int 
toExclusive) {
+        BitmapDeletionVector deletionVector = new BitmapDeletionVector();
+        for (int position = fromInclusive; position < toExclusive; position++) 
{
+            deletionVector.delete(position);
+        }
+        return deletionVector;
+    }
+
     private static final class CountingFileIO extends LocalFileIO {
 
         private final LocalFileIO fileIO;

Reply via email to