-
Notifications
You must be signed in to change notification settings - Fork 3k
Cache PositionIndex #5264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache PositionIndex #5264
Conversation
|
@rdblue cc |
| if (deleteRowPositions == null) { | ||
| deleteRowPositions = Deletes.toPositionIndex(filePath, deletes); | ||
| } | ||
| Predicate<T> isDeleted = record -> deleteRowPositions.isDeleted(pos(record)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If deleteRowPositions is null, is this predicate at risk of an NPE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No NPE. The return of " Deletes.toPositionIndex(filePath, deletes)" must not be null.
| if (posDeletes.stream().mapToLong(DeleteFile::recordCount).sum() < setFilterThreshold) { | ||
| PositionDeleteIndex positionIndex = Deletes.toPositionIndex(filePath, deletes); | ||
| Predicate<T> isDeleted = record -> positionIndex.isDeleted(pos(record)); | ||
| if (deleteRowPositions == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should run line 225 to open the deletes if they can be reused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get you
| List<CloseableIterable<Record>> deletes = Lists.transform(posDeletes, this::openPosDeletes); | ||
|
|
||
| // if there are fewer deletes than a reasonable number to keep in memory, use a set | ||
| if (posDeletes.stream().mapToLong(DeleteFile::recordCount).sum() < setFilterThreshold) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the else case? In that case we will not cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it won't cache because the deletes are streamed from files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Because it use sort merge to avoid loading too many delete rows in memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, They should't reopen position delete file and read position delete file from head, they should read position delete file continue。I will do some change here
|
I add some code to reuse Merge Sort, I don't know whether it is suitable |
Like #5195 PositionIndex also can be cache