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

Add IPC truncation test case for StructArray #2083

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 15, 2022

Which issue does this PR close?

Closes #2082.
Related to #2080.

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

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

Codecov Report

Merging #2083 (6e4e872) into master (cb7e5b0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 6e4e872 differs from pull request most recent head fbd6360. Consider uploading reports for the commit fbd6360 to get more accurate results

@@           Coverage Diff           @@
##           master    #2083   +/-   ##
=======================================
  Coverage   83.68%   83.69%           
=======================================
  Files         224      224           
  Lines       58826    58855   +29     
=======================================
+ Hits        49227    49256   +29     
  Misses       9599     9599           
Impacted Files Coverage Δ
parquet/src/arrow/record_reader/mod.rs 89.17% <ø> (ø)
arrow/src/ipc/writer.rs 85.46% <100.00%> (+0.41%) ⬆️
parquet/src/arrow/arrow_reader.rs 92.76% <100.00%> (+0.09%) ⬆️

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 cb7e5b0...fbd6360. Read the comment docs.

}

let record_batch = create_batch();
let record_batch_slice = record_batch.slice(1, 2);
Copy link
Contributor

@tustvold tustvold Jul 15, 2022

Choose a reason for hiding this comment

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

There is currently an odd hack in ArrayData::slice for StructArray that pushes down the offset to the child arrays. You will need to manually construct the ArrayData for the StructArray in order to properly test the case of a StructArray with a non-zero offset. See #1750 for more information

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #2085

Copy link
Member Author

Choose a reason for hiding this comment

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

ArrayData::Slice contains a special case for StructArray where it recurses the offset into its children. However, it preserves the offset on the parent ArrayData, in order for the validity buffer to work correctly.

I do see there is an special case, but not understand "it preserves the offset on the parent ArrayData".

let new_offset = self.offset + offset;
let new_data = ArrayData {
  ...
  offset: new_offset,
  ...
};

It updates new ArrayData with new offset, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but it also applies the offset to the child data, which is the topic of that ticket. We have partially pushed down the offset, which at best is extremely confusing, but is likely just plain incorrect

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. You are basically concerned about "This makes it unclear if an offset should or should not be applied to the child_array". As the updated offset is applied on both parent array and child arrays, it is somehow obscure that whether we should take parent's offset when working with child arrays.

Copy link
Contributor

Choose a reason for hiding this comment

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

Precisely 👍

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.

This will need to be changed based on #2085, but having this test is a good step forward 👍

@tustvold tustvold merged commit 32867e3 into apache:master Jul 15, 2022
@ursabot
Copy link

ursabot commented Jul 15, 2022

Benchmark runs are scheduled for baseline = a7181dd and contender = 32867e3. 32867e3 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

@viirya
Copy link
Member Author

viirya commented Jul 15, 2022

Thanks @tustvold

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

Successfully merging this pull request may close these issues.

Add IPC truncation test case for StructArray
4 participants