Repository navigation
[core] Sort Data Evolution file groups by user-specified columns - #11262
Open
JingsongLi wants to merge 6 commits into
Open
JingsongLi wants to merge 6 commits into
JingsongLi wants to merge 6 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Selective queries on a Data Evolution append table can open many data, BLOB and vector files when values of the filter column are scattered across file groups. This prototype adds
sys.sort_data_evolutionto Spark and Flink batch SQL so callers can cluster a chosen part of the table by the columns they query.Use the
$row_rangessystem table to choose the bounds. Each row describes the smallest independently rewritable range in a partition at a single snapshot. The file count and total bytes include ordinary, BLOB and vector files.The input row-ID bounds are inclusive. The optional final argument filters partitions. The planner checks every intersecting file in the planning snapshot and rejects a boundary that cuts a file group before any writes start. Each selected partition gets one spillable sort. The sort uses ascending keys with nulls first and uses the old row ID to break ties.
The rewrite reads the latest visible values, applies deletion vectors, and writes ordinary columns, managed BLOBs and dedicated vectors in the same new row order. Surviving rows receive new IDs. Downstream references to those IDs need updating, and global indexes in rewritten partitions need rebuilding.
Tests
DataEvolutionDeleteSqlITCase.SortDataEvolutionBenchmarkcompared ordinary compaction and sorting on branches from the same 32,768-row snapshot. Both layouts had eight main data files with matching row counts. The query selected 64 rows by the sort key and read scalar, BLOB and vector values. File and byte counts come from an instrumented table read. SQL timings use 20 local Spark runs per layout after warm-up.