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 ColumnValueDecoderImpl #2089

Merged
merged 5 commits into from Jul 16, 2022

Conversation

thinkharderdev
Copy link
Contributor

Which issue does this PR close?

Closes #2078

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate parquet Changes to the parquet crate labels Jul 16, 2022
fn values_left(&self) -> usize {
self.values_left
}

fn encoding(&self) -> Encoding {
Encoding::DELTA_BINARY_PACKED
}

fn skip(&mut self, num_values: usize) -> Result<usize> {
let mut buffer = vec![T::T::default(); num_values];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to kind of defeat the purpose but not sure how to skip delta encoded values without it....

@@ -922,6 +974,11 @@ impl<T: DataType> Decoder<T> for DeltaByteArrayDecoder<T> {
fn encoding(&self) -> Encoding {
Encoding::DELTA_BYTE_ARRAY
}

fn skip(&mut self, num_values: usize) -> Result<usize> {
let mut buffer = vec![T::T::default(); num_values];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here

@thinkharderdev
Copy link
Contributor Author

@Ted-Jiang

@thinkharderdev thinkharderdev changed the title Issue 2078 Support skip_values in ColumnValueDecoderImpl Jul 16, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2022

Codecov Report

Merging #2089 (7657f96) into master (72dada6) will increase coverage by 0.03%.
The diff coverage is 86.59%.

@@            Coverage Diff             @@
##           master    #2089      +/-   ##
==========================================
+ Coverage   83.70%   83.73%   +0.03%     
==========================================
  Files         224      224              
  Lines       58958    59391     +433     
==========================================
+ Hits        49350    49734     +384     
- Misses       9608     9657      +49     
Impacted Files Coverage Δ
parquet/src/column/reader/decoder.rs 63.38% <0.00%> (-5.86%) ⬇️
parquet/src/data_type.rs 75.74% <84.00%> (+0.98%) ⬆️
parquet/src/encodings/decoding.rs 88.70% <85.79%> (-0.84%) ⬇️
parquet/src/encodings/rle.rs 92.59% <92.77%> (+0.03%) ⬆️
parquet/src/util/bit_util.rs 93.70% <92.95%> (-0.11%) ⬇️
arrow/src/compute/kernels/take.rs 95.46% <0.00%> (+0.19%) ⬆️
arrow/src/array/array_union.rs 90.89% <0.00%> (+0.74%) ⬆️

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 72dada6...7657f96. Read the comment docs.

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

Awesome work, only some minor nits

tonic::Response<tonic::codec::Streaming<super::HandshakeResponse>>,
tonic::Status,
> {
tonic::Response<tonic::codec::Streaming<super::HandshakeResponse>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if you have an out of date lockfile, which is resulting in these changes??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was it. Thanks!

arrow/Cargo.toml Outdated
@@ -41,7 +41,7 @@ bench = false
ahash = { version = "0.7", default-features = false }
serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, features = ["preserve_order"] }
serde_json = { version = "1.0", default-features = false, features = ["preserve_order","std"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be necessary if you update your lockfile

let bit_reader = decoder.bit_reader.as_mut().unwrap();
let num_values = std::cmp::min(num_values, decoder.num_values);
let mut buffer = vec![false; num_values];
let values_read = bit_reader.get_batch(&mut buffer[..num_values], 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

BitReader::skip?

#[inline]
fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize> {
let data = decoder.data.as_ref().expect("set_data should have been called");
let num_values = std::cmp::min(num_values, decoder.num_values);
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
let num_values = std::cmp::min(num_values, decoder.num_values);
let num_values = num_values.min(decoder.num_values);

.data
.as_mut()
.expect("set_data should have been called");
let num_values = std::cmp::min(num_values, decoder.num_values);
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
let num_values = std::cmp::min(num_values, decoder.num_values);
let num_values = num_values.min(decoder.num_values);

"eee", "fff", "ddd", "eee", "fff", "eee", "fff",
"fff",
];
let skipped = decoder.skip(4).expect("skipping two values");
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
let skipped = decoder.skip(4).expect("skipping two values");
let skipped = decoder.skip(4).expect("skipping four values");


let mut values_skipped = 0;

if num_bits > 32 {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this special case for skip, this exists in get_batch because we only have unpack32 and not unpack64

@@ -355,6 +362,8 @@ impl<T: DataType> Decoder<T> for DictDecoder<T> {
rle.get_batch_with_dict(&self.dictionary[..], buffer, num_values)
}


Copy link
Member

Choose a reason for hiding this comment

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

nit: useless space.

@@ -291,6 +294,10 @@ impl<T: DataType> Decoder<T> for PlainDecoder<T> {
fn get(&mut self, buffer: &mut [T::T]) -> Result<usize> {
T::T::decode(buffer, &mut self.inner)
}

Copy link
Member

Choose a reason for hiding this comment

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

Should we set #[inline] get better perfomance ?🤔

Copy link
Member

Choose a reason for hiding this comment

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

because i fond encoding set_data all with inline

@Ted-Jiang
Copy link
Member

Nice job! 🥳

@tustvold tustvold removed arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels Jul 16, 2022
thinkharderdev and others added 2 commits July 16, 2022 14:49
Co-authored-by: Yang Jiang <jiangyang381@163.com>
@tustvold tustvold merged commit c585544 into apache:master Jul 16, 2022
@ursabot
Copy link

ursabot commented Jul 16, 2022

Benchmark runs are scheduled for baseline = 13adaa7 and contender = c585544. c585544 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 ColumnValueDecoderImpl
5 participants