-
Notifications
You must be signed in to change notification settings - Fork 374
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
[ISSUE-607]Add map ids info for each PartitionLocation to enable filtering for m… #619
Merged
waitinfuture
merged 9 commits into
main
from
607-featureoptimize-add-map-ids-info-for-each-partitionlocation-to-enable-filtering-for-map-range-reading
Sep 23, 2022
+150
−31
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bbe0210
Add map ids info for each PartitionLocation to enable filtering for m…
FMX 8aa01ff
fix uts.
FMX 407638a
refine.
FMX 8edda0a
refine.
FMX 5c7b2a3
address comments
waitinfuture 3460630
add reader double check.
FMX 0850af0
Merge branch 'main' into 607-featureoptimize-add-map-ids-info-for-eac…
FMX a46abe8
fix a multithread problem.
FMX 4d9659d
update by tests.
FMX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,41 +142,56 @@ private static final class RssInputStreamImpl extends RssInputStream { | |
moveToNextReader(); | ||
} | ||
|
||
private void moveToNextReader() throws IOException { | ||
if (currentReader != null) { | ||
currentReader.close(); | ||
private boolean skipLocation(int startMapIndex, int endMapIndex, PartitionLocation location) { | ||
if (endMapIndex == Integer.MAX_VALUE) { | ||
return false; | ||
} | ||
for (int i = startMapIndex; i < endMapIndex; i++) { | ||
if (location.getMapIdBitMap().contains(i)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
private PartitionLocation nextReadableLocation() { | ||
int locationCount = locations.length; | ||
if (fileIndex >= locationCount) { | ||
return null; | ||
} | ||
PartitionLocation currentLocation = locations[fileIndex]; | ||
currentReader = createReader(currentLocation); | ||
logger.debug( | ||
"Moved to next partition {},startMapIndex {} endMapIndex {} , {}/{} read ", | ||
currentLocation, | ||
startMapIndex, | ||
endMapIndex, | ||
fileIndex, | ||
locationCount); | ||
while (!currentReader.hasNext() && fileIndex < locationCount - 1) { | ||
while (skipLocation(startMapIndex, endMapIndex, currentLocation)) { | ||
fileIndex++; | ||
if (fileIndex == locationCount) { | ||
return null; | ||
} | ||
currentLocation = locations[fileIndex]; | ||
} | ||
return currentLocation; | ||
} | ||
|
||
private void moveToNextReader() throws IOException { | ||
if (currentReader != null) { | ||
currentReader.close(); | ||
currentReader = createReader(currentLocation); | ||
logger.debug( | ||
"Moved to next partition {},startMapIndex {} endMapIndex {} , {}/{} read ", | ||
currentLocation, | ||
startMapIndex, | ||
endMapIndex, | ||
fileIndex, | ||
locationCount); | ||
currentReader = null; | ||
} | ||
if (currentReader.hasNext()) { | ||
currentChunk = currentReader.next(); | ||
fileIndex++; | ||
} else { | ||
PartitionLocation currentLocation = nextReadableLocation(); | ||
if (currentLocation == null) { | ||
return; | ||
} | ||
currentReader = createReader(currentLocation); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why delete the following logic? For normal read we don't know if currentReader has chunks.
|
||
fileIndex++; | ||
while (!currentReader.hasNext()) { | ||
currentReader.close(); | ||
currentReader = null; | ||
currentLocation = nextReadableLocation(); | ||
if (currentLocation == null) { | ||
return; | ||
} | ||
currentReader = createReader(currentLocation); | ||
fileIndex++; | ||
} | ||
currentChunk = currentReader.next(); | ||
} | ||
|
||
private PartitionReader createReader(PartitionLocation location) throws IOException { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.