[core] Optimize data-evolution scan with index#7305
Merged
JingsongLi merged 4 commits intoapache:masterfrom Feb 26, 2026
Merged
[core] Optimize data-evolution scan with index#7305JingsongLi merged 4 commits intoapache:masterfrom
JingsongLi merged 4 commits intoapache:masterfrom
Conversation
JingsongLi
requested changes
Feb 26, 2026
| for (DataFileMeta file : dataSplit.dataFiles()) { | ||
| fileRanges.add(file.nonNullRowIdRange()); | ||
| } | ||
| Function<Split, List<IndexedSplit>> process = |
Contributor
There was a problem hiding this comment.
Introduce a static method for this?
| return () -> indexedSplits; | ||
| } | ||
|
|
||
| private static int lowerBoundRangeTo(List<Range> ranges, long target) { |
Contributor
There was a problem hiding this comment.
You should use RowRangeIndex.
| } | ||
|
|
||
| @VisibleForTesting | ||
| static final class RowRangeIndex { |
Contributor
There was a problem hiding this comment.
Extract this class to a separate class.
| } | ||
|
|
||
| @VisibleForTesting | ||
| static boolean intersectsRowRanges(RowRangeIndex index, long fileFrom, long fileTo) { |
Contributor
There was a problem hiding this comment.
Move this method into RowRangeIndex.
|
|
||
| // No matching indices found, skip this entry | ||
| return false; | ||
| private RowRangeIndex(long[] starts, long[] ends) { |
Contributor
There was a problem hiding this comment.
Pass a List<Range> ranges into here, and you should sort it here.
| for (Range expected : rowRanges) { | ||
| if (Range.intersection(fileRowRange, expected) != null) { | ||
| return true; | ||
| private static int lowerBound(long[] sorted, long target) { |
| } | ||
|
|
||
| @VisibleForTesting | ||
| static RowRangeIndex buildRowRangeIndex(List<Range> sortedAndMerged) { |
Contributor
There was a problem hiding this comment.
Move this into RowRangeIndex.
| List<Split> splits = batchScan.withRowRanges(rowRanges).plan().splits(); | ||
| return wrapToIndexSplits(splits, rowRanges, scoreGetter); | ||
| List<Range> sortedPushDownRanges = Range.sortAndMergeOverlap(rowRanges, true); | ||
| List<Split> splits = batchScan.withRowRanges(sortedPushDownRanges).plan().splits(); |
Contributor
There was a problem hiding this comment.
You can add a new method batchScan.withRowRanges(RowRangeIndex)
2754909 to
7a87a0b
Compare
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
Speed up scan with large rowRanges.
Testing:
40w rowRange push down, cost 3720ms before this optimization, cost 400ms+ after this optimization. (By starrocks engine)
Tests
API and Format
Documentation
Generative AI tooling