Repository navigation
[core][spark] Keep vector-store files of touched ranges in Data Evolution MERGE - #11458
LuciferYang wants to merge 3 commits into
Conversation
JingsongLi
left a comment
There was a problem hiding this comment.
All 76 RowTrackingTest cases passed on Spark 3.5.9. I reproduced the case below with a local Data Evolution table and compared it with the base MERGE implementation.
| .filter(file => isBlobFile(file.fileName())) | ||
| // Blob and vector-store files roll on their own size, so a range may hold several of | ||
| // them, starting at row ids that are not the first row id of any normal file. | ||
| .filter(file => isBlobFile(file.fileName()) || isVectorStoreFile(file.fileName())) |
There was a problem hiding this comment.
[P1] Preserve the normal file when a vector backfill starts later in its range
I wrote one normal file for RowIDs 0–3, added a nullable vector column and backfilled only RowIDs 2–3 into one vector file. A MERGE on _ROW_ID = 0 updating an ordinary column succeeds on the base and preserves both vectors. On this revision it fails with First row ID 0 not found in partition map. findRelatedFirstRowIds replaces the normal start with the dedicated starts whenever the map contains an entry, so the newly mapped vector start 2 removes start 0 from the target scan. Please keep the normal start alongside the dedicated starts in both Spark implementations and cover a partial vector backfill.
There was a problem hiding this comment.
Fixed. findRelatedFirstRowIds now keeps the range start next to the dedicated starts, in both copies.
Keeping the start exposed a second failure in your layout. The split then carries the vector file for rows 2 and 3, and a MERGE that sets x reads it with a read type without the vector column, so the file becomes its own bunch and fails "All files in a field merge split should have the same row count". DataEvolutionSplitRead now drops vector-store files that hold no read field when the group has a normal file.
Tests: "Data Evolution: merge into a range whose vector column is backfilled from a later row" in RowTrackingTestBase runs your case on both _ROW_ID and id, setting x or the vector column. VectorStoreTableTest.testReadWithoutAVectorColumnBackfilledFromALaterRow covers the read path alone.
…only groups in incremental reads
JingsongLi
left a comment
There was a problem hiding this comment.
The focused Core suites passed. The streaming delta path changes which rows are delivered when a reader selects a partially backfilled vector column.
| && kept.stream().allMatch(e -> isDedicatedFile(e.file()))) { | ||
| kept.add(retrieveAnchorFile(group, ManifestEntry::file)); | ||
| } | ||
| if (!kept.isEmpty()) { |
There was a problem hiding this comment.
[P1] Preserve row coverage when projecting a vector-only delta
VectorStoreTableTest.testStreamingReadOfANormalColumnOverVectorOnlyChanges reproduces this on a real deletion-vector-enabled Data Evolution table. One delta contains embedding over RowIDs 0–3 and embedding_v2 over 2–3. Reading id, _ROW_ID returns 0–3. Adding embedding_v2 to the projection returns only 2–3, with no row predicate. ReadBuilder.withProjection is also used by the Flink streaming source, so projecting a column can silently omit two change rows after this change makes the delta readable. When no normal file exists, preserve the group's complete RowID coverage during pruning and let the range reader fill the uncovered projected values with NULL.
Purpose
close #11456
A Data Evolution MERGE keeps only the files of touched row-id ranges. Vector-store files roll like blob files, so a range can hold several, but only blob files were mapped to their range. Vector files starting inside a touched range were dropped: updating another column failed the row-count check, and updating the vector column wrote NULL into the rest of the range.
MergeIntoPaimonDataEvolutionTablemaps vector-store files and keeps the range start, since the vector column may be backfilled from a later row.DataEvolutionSplitReaddrops vector-store files holding no read field when the group has a normal file.For vector-store-only groups, incremental reads read by range when the files cover different rows; delta scans, and scans without deletion vectors, keep the group instead of failing to plan.
#11156 keeps this mapping blob-only, in
DataEvolutionMergeMetadata.summarizeand both inline fallbacks; whichever PR merges second adds vector-store files to all three.Tests
RowTrackingTestBase, each with ON_ROW_IDand ONid, setting a normal or the vector column:VectorStoreTableTest:testReadWithoutAVectorColumnBackfilledFromALaterRow: readsidandid, embeddingfrom splits planned for all columns, and_ROW_ID.testReadOfARenamedVectorColumnNextToABackfilledOne: files are matched by field id.testIncrementalRowIdReadOfVectorOnlyChanges,testIncrementalReadOfVectorOnlyChangesWithAPartialUnreadColumn: every row of the range is read, with and without a pushed-down row range.testStreamingReadOfANormalColumnOverVectorOnlyChanges, with and without deletion vectors: the next plan reads four rows with NULLid, and rows 2 and 3 forembedding_v2.testFileCreationTimeScanOfVectorOnlyChangesWithDeletionVectors: planning fails, as on master.DataEvolutionFileStoreScanTest.testReadTypePruningKeepsVectorOnlyGroupWithoutReadField: delta scans, or any scan without deletion vectors, keep both vector files; with deletion vectors, other scans still throw.