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
Support skip_def_levels for ColumnLevelDecoder #2111
Merged
+139
−6
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
001cf10
Support skip_def_levels (only max_def_levels=1) for ColumnLevelDecoder
Ted-Jiang 6e9519f
Support skip_def_levels (only max_def_levels=1) for ColumnLevelDecode…
Ted-Jiang fbc29f6
fix ut
Ted-Jiang da14cb0
fix and refine support skip definition_level
Ted-Jiang 24c4519
fix clippy
Ted-Jiang 79e03b9
fix comment
Ted-Jiang File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -318,10 +318,41 @@ impl ColumnLevelDecoder for ColumnLevelDecoderImpl { | |
impl DefinitionLevelDecoder for ColumnLevelDecoderImpl { | ||
fn skip_def_levels( | ||
&mut self, | ||
_num_levels: usize, | ||
_max_def_level: i16, | ||
num_levels: usize, | ||
max_def_level: i16, | ||
) -> Result<(usize, usize)> { | ||
Err(nyi_err!("https://github.com/apache/arrow-rs/issues/1792")) | ||
let mut level_skip = 0; | ||
let mut value_skip = 0; | ||
match self.decoder.as_mut().unwrap() { | ||
LevelDecoderInner::Packed(reader, bit_width) => { | ||
for _ in 0..num_levels { | ||
Ted-Jiang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Values are delimited by max_def_level | ||
if max_def_level | ||
== reader | ||
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. will test in #2106 |
||
.get_value::<i16>(*bit_width as usize) | ||
.expect("Not enough values in Packed ColumnLevelDecoderImpl.") | ||
{ | ||
value_skip += 1; | ||
} | ||
level_skip += 1; | ||
} | ||
} | ||
LevelDecoderInner::Rle(reader) => { | ||
for _ in 0..num_levels { | ||
if let Some(level) = reader | ||
.get::<i16>() | ||
.expect("Not enough values in Rle ColumnLevelDecoderImpl.") | ||
{ | ||
// Values are delimited by max_def_level | ||
if level == max_def_level { | ||
value_skip += 1; | ||
} | ||
} | ||
level_skip += 1; | ||
} | ||
} | ||
} | ||
Ok((value_skip, level_skip)) | ||
} | ||
} | ||
|
||
|
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.
👍