Skip to content
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_values in ByteArrayColumnValueDecoder #2076

Merged
merged 3 commits into from Jul 16, 2022

Conversation

Ted-Jiang
Copy link
Member

Which issue does this PR close?

Closes #2072.

Support skip values during decoding, will support bytesArray first which include:

    Plain(ByteArrayDecoderPlain),
    Dictionary(ByteArrayDecoderDictionary),
    DeltaLength(ByteArrayDecoderDeltaLength),
    DeltaByteArray(ByteArrayDecoderDelta),

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the parquet Changes to the parquet crate label Jul 15, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #2076 (087ea27) into master (86543a4) will increase coverage by 0.08%.
The diff coverage is 89.62%.

@@            Coverage Diff             @@
##           master    #2076      +/-   ##
==========================================
+ Coverage   83.61%   83.70%   +0.08%     
==========================================
  Files         223      224       +1     
  Lines       58539    58958     +419     
==========================================
+ Hits        48947    49350     +403     
- Misses       9592     9608      +16     
Impacted Files Coverage Δ
parquet/src/arrow/array_reader/byte_array.rs 86.31% <89.62%> (+1.83%) ⬆️
...row/src/array/builder/string_dictionary_builder.rs 90.64% <0.00%> (-0.72%) ⬇️
arrow/src/array/builder/primitive_builder.rs 92.57% <0.00%> (-0.55%) ⬇️
arrow/src/array/array_decimal.rs 90.59% <0.00%> (-0.53%) ⬇️
parquet_derive/src/parquet_field.rs 65.75% <0.00%> (-0.23%) ⬇️
arrow/src/datatypes/mod.rs 99.24% <0.00%> (ø)
arrow/src/util/bit_mask.rs 100.00% <0.00%> (ø)
parquet/src/arrow/record_reader/mod.rs 89.17% <0.00%> (ø)
arrow/src/datatypes/delta.rs 100.00% <0.00%> (ø)
parquet/src/arrow/arrow_reader.rs 92.76% <0.00%> (+0.09%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86543a4...087ea27. Read the comment docs.

@Ted-Jiang
Copy link
Member Author

@tustvold PTAL😄

let mut values_skip = 0;
while values_skip < to_skip {
if self.index_offset == self.index_buf_len {
let read = self.decoder.get_batch(self.index_buf.as_mut())?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly something for a follow up PR, but it would be nice if we could avoid decoding values only to dump them on the floor

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! file an issue #2088

assert_eq!(decoder.skip_values(1).unwrap(), 1);
assert_eq!(decoder.skip_values(1).unwrap(), 1);

assert_eq!(decoder.read(&mut output, 0..1).unwrap(), 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(decoder.read(&mut output, 0..1).unwrap(), 1);
assert_eq!(decoder.read(&mut output, 1..2).unwrap(), 1);

The decoder doesn't actually care, as it keeps track of the number of read values, but this is technically more correct

Copy link
Member Author

@Ted-Jiang Ted-Jiang Jul 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your are right! 👍, finally it just need the length.
Why not change

fn read(&mut self, out: &mut Self::Slice, range: Range<usize>) -> Result<usize>;

to

fn read(&mut self, out: &mut Self::Slice, length: usize) -> Result<usize>;

Is there any reason 🤔

Copy link
Contributor

@tustvold tustvold Jul 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because for backwards compatibility we need to support decoding to a slice, as opposed to a container that tracks its length.

See ColumnValueDecoderImpl

Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
@tustvold tustvold merged commit 72dada6 into apache:master Jul 16, 2022
@ursabot
Copy link

ursabot commented Jul 16, 2022

Benchmark runs are scheduled for baseline = 32867e3 and contender = 72dada6. 72dada6 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support skip_values in ByteArrayColumnValueDecoder
5 participants