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

Restrict Decoder to compatible types (#1276) #1277

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Feb 6, 2022

Which issue does this PR close?

Closes #1276.

Rationale for this change

See ticket

What changes are included in this PR?

Restricts decoders to the types for which they make sense

Are there any user-facing changes?

Sort of, invalid decoders will now error on construction instead of when attempting to read data from them, and this may change the error behaviour of public APIs. I'm not sure if this counts.

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

Codecov Report

Merging #1277 (c618952) into master (ce15d0c) will increase coverage by 0.01%.
The diff coverage is 97.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1277      +/-   ##
==========================================
+ Coverage   83.02%   83.03%   +0.01%     
==========================================
  Files         180      180              
  Lines       52269    52296      +27     
==========================================
+ Hits        43394    43423      +29     
+ Misses       8875     8873       -2     
Impacted Files Coverage Δ
parquet/src/data_type.rs 76.61% <ø> (ø)
parquet/src/encodings/decoding.rs 90.73% <97.36%> (+0.27%) ⬆️
parquet/src/encodings/encoding.rs 93.71% <0.00%> (+0.19%) ⬆️
parquet_derive/src/parquet_field.rs 66.21% <0.00%> (+0.22%) ⬆️
arrow/src/datatypes/datatype.rs 66.80% <0.00%> (+0.42%) ⬆️

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 ce15d0c...c618952. Read the comment docs.

Copy link
Member

@sunchao sunchao left a comment

Choose a reason for hiding this comment

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

LGTM.

I think the decoders currently only support decoding to T::T at the moment. Not sure whether it makes sense to have a separate API that decodes directly into Arrow array. This may be beneficial to certain types such as boolean (we can directly copy the bits instead of decode to bool). Potentially we can also avoid pad_nulls based on this.

@tustvold
Copy link
Contributor Author

tustvold commented Feb 6, 2022

I think the decoders currently only support decoding to T::T at the moment. Not sure whether it makes sense to have a separate API that decodes directly into Arrow array.

Yeah, this was one of the motivations behind #1041 - providing the ability to decode to things that aren't DataType, and don't wish to be. It was then used in #1054, #1082 and #1180.

This may be beneficial to certain types such as boolean (we can directly copy the bits instead of decode to bool)

FYI I did this in #1054

@sunchao
Copy link
Member

sunchao commented Feb 6, 2022

I see, thanks! Will check these changes.

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.

Prevent Constructing Decoder for Incompatible Types
4 participants