Repository navigation
[core] Fix Data Evolution incremental DIFF reads - #11285
JustinBinber wants to merge 11 commits into
Conversation
JingsongLi
left a comment
There was a problem hiding this comment.
The Data Evolution DIFF fix addresses a real read failure, and all 27 submitted and related Core tests passed on the current-master integration. A separate real-table test found one incorrect result through the public Java API.
[P1] Intersect DIFF file ranges with the caller's requested RowIDs. I appended [100] in snapshot 1 and [200, 300] in one Parquet file in snapshot 2. A regular scan with withRowRanges([2,2]) returned [300]. Applying the same range to DIFF 1,2 still planned [1,2] and returned both rows. A second test using partial-column updates reproduced the same behavior.
SnapshotReaderImpl.toDataEvolutionIncrementalPlan constructs an IndexedSplit covering the added file range. The manifest scan only checks range overlap at file level, and DataEvolutionBatchScan.wrap returns the existing IndexedSplit without applying the exact row-range restriction. Please intersect the already-selected DIFF ranges with the active row-range index and suppress empty intersections. Cover a requested range that selects a strict subset of one changed file.
|
[P1] Resolve the historical end snapshot before using a global index. In a Parquet Data Evolution table, snapshot 1 contained
|
|
Reproduced and addressed both P1 reports in
The normal Maven Core reactor passes all 32 focused tests; six targeted Spark cases also pass with the current Core classes. Fresh upstream CI is automatic for this new head and is still pending; the earlier green run belongs to adad80e. |
JingsongLi
left a comment
There was a problem hiding this comment.
The two earlier findings are addressed. I tested this head integrated with current master. All 32 focused Core tests passed, and Spark 3.5.9 passed the DE DIFF SQL case and the five affected compaction race cases. Two additional checks showed gaps in the new split path.
|
CI infrastructure follow-up for The run has now completed: all other 17 selected checks passed, including Core/JDK 8 and 11, Spark 3/Scala 2.12, Spark 4/4.2/4.3 and Flink integrations. The second failed check is the dependent CI result, which reports the same Java matrix failure. I attempted the single-job rerun endpoint, which returned |
JingsongLi
left a comment
There was a problem hiding this comment.
Two P2 findings reproduced locally on e5c67566ca.
|
The changes are becoming increasingly extensive; does this requirement stem from actual production needs? |
Purpose
Data Evolution batch DIFF scans produce
IncrementalSplitobjects that the DE reader cannot read, causing nonempty snapshot and tag differences to fail withClassCastException. Reading only newly added column files would also lose untouched columns and the shared deletion-vector anchor.Plan the complete end-snapshot dependency groups for added manifest-entry RowID ranges, and reuse existing
IndexedSplitreads. Both metadata inventories are computed without projection, data-statistics or LIMIT pruning; caller scan settings are restored afterward. Shared files reconstruct unchanged columns and provide the end-snapshot DV anchor. Requested RowID ranges further restrict each split, including strict subsets, empty selections and clearing/replacing ranges through either SnapshotReader setter.Do not report an exact visible row count when an indexed split has deletion vectors: LIMIT must be able to read past an entirely deleted split.
Automatic global-index lookup is disabled for incremental reads until index evaluation, coverage and the data plan can use the same resolved historical endpoint. This covers eager and reader-side index modes, including tag ranges. DIFF rejects unbound external results and accepts explicit RowID selections through
withRowRanges. DELTA and AUTO resolved to DELTA preserve caller-supplied RowIDs and scores. Ordinary latest/time-travel snapshot index optimizations and latest-snapshot external selections remain available.Existing compaction-race fixtures inspect the latest commit's ADD entries directly instead of depending on a query split implementation. Their retry, file-identity, concurrency and nested-field assertions are retained.
The documented contract is file incremental: return visible end-snapshot rows in ranges covered by added file entries. Compaction may repeat rows, and deletion-only changes produce no positive rows. This is not row-level CDC and does not introduce streaming metadata planning. Ordinary append and primary-key DIFF paths remain unchanged. This correctness fix is independent of the memory optimization in #11156.
Changed RowID ranges are indexed once per partition/bucket. Each split queries only its actual intervals and intersects caller selections through the existing RowRangeIndex; gaps are preserved. Indexed readers retain both physical file metadata and score/RowID metadata through filtering and projection. Unscored row fetching used by lateral vector search keeps its existing ScoreRecordReader contract, including the NaN placeholder; scored reads retain their existing mapping.
Tests
Current CI for
3bc3b0c016: automatic run. The final version integrated with upstream8d704811cbpassed 17 focused Core tests and 3 Spark 3.5.9 SQL tests locally. These cover the original file path, physical positions 0 and 2 after deleting the middle row, full row reconstruction, and a reader score of 0.42 through DELTA and AUTO.Historical Spark 4.3 validation: an earlier run exposed an unchanged upstream Spark 4.3 test-compilation defect (
VariantTestBasemissing), also reproduced on clean upstream71082ea86a. A separate build-only commit adds the same test-scope shared UT tests-jar dependency already used by Spark 4.2, with all transitive dependencies excluded. On JDK 17 / Scala 2.13 / Spark 4.3, normal Maven compiled the shared UT and Spark 4.3 test sources and passed normal formatting/checkstyle/enforcer checks. All 152 Variant cases passed in a bounded 1.5 GiB JVM using that exact reactor test classpath. The previous PR head also passed a clean 28-module Maven package with-DskipTests, compiling all shared UT and Spark 4.3 tests; this is build validation and does not add executed test cases to the counts above. Broader local compatibility runs encountered existing Windows file-URI and missing-winutils failures, and one was stopped by the memory-reserve guard; those are not reported as passing full suites. No tests were removed or excluded. Upstream now includes the equivalent Spark 4.3 build fix in #11313.JDK 8 / Scala 2.12 / Spark 3.5.9 current-source verification after merging upstream
71082ea86a:git diff --checkpassed.A metadata-only JDK 8 range-intersection microbenchmark includes index construction and checks the same results. At 25k/50k/100k gapped intervals, three alternating-repeat medians change from 333/1355/5368 ms to 6.84/7.71/12.48 ms. With sparse caller selections, 100k changes from 10151 ms to 26.11 ms. This measures only range intersection, not complete planning, SQL or distributed performance.
The real-table tests cover duplicate/NULL rows, implicit tag DIFF, multiple partial updates, unchanged-column projection, predicates, end-snapshot DVs on shared anchors, a dedicated BLOB subrange inside a wider normal range, serialized splits, deletion-only/empty results and LIMIT across a fully deleted split. Ordinary append and primary-key reads are controls.
Review regressions assert strict requested RowIDs after append/partial updates, no unrequested live rows around a deleted selection, and both SnapshotReader range setters including empty/null resets. The B-tree regression returns historical
(200,20)for end snapshot 2 after the latest row became(200,30), in both eager/reader index modes and snapshot/tag ranges; the latest read still uses its index and returns(200,30).RED/GREEN evidence uses the same fixtures and runtime: the initial clean upstream
3a8e01f35dbaseline failed 8 of 17 original Core cases while 9 controls passed; the reported range/historical-index cases reproduced wrong results onadad80e295and pass after this follow-up. Removing only the DV row-count fix also reproduces an empty LIMIT result where a later live row is required.The prior JDK-install failure was superseded by a successful run on the unchanged source tree.