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

Change builder append methods to be infallible where possible #2103

Merged
merged 5 commits into from
Jul 20, 2022

Conversation

jhorstmann
Copy link
Contributor

@jhorstmann jhorstmann commented Jul 18, 2022

Which issue does this PR close?

Closes #2071.

Rationale for this change

Infallible methods are easier to use and less confusing when there are no actual error cases.

What changes are included in this PR?

Nearly all append methods in builders are now infallible. The following builders still have fallible methods

  • FixedSizeBinaryBuilder when the given slice has the wrong length
  • StringDictionaryBuilder in case the key datatype would overflow
  • DecimalBuilder/Decimal256Builder in case the precision, scale or byte length does not match
  • MapBuilder when the key and values builders are in an inconsistent state of not having the same length

Are there any user-facing changes?

Yes, a lot of them

@github-actions github-actions bot added arrow Changes to the arrow crate parquet Changes to the parquet crate labels Jul 18, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2022

Codecov Report

Merging #2103 (8a4dd03) into master (2541e2c) will increase coverage by 0.00%.
The diff coverage is 98.00%.

@@           Coverage Diff           @@
##           master    #2103   +/-   ##
=======================================
  Coverage   83.73%   83.74%           
=======================================
  Files         225      225           
  Lines       59412    59401   -11     
=======================================
- Hits        49748    49743    -5     
+ Misses       9664     9658    -6     
Impacted Files Coverage Δ
arrow/src/array/mod.rs 100.00% <ø> (ø)
arrow/src/buffer/mutable.rs 89.13% <ø> (ø)
arrow/src/compute/kernels/temporal.rs 94.10% <ø> (ø)
arrow/src/csv/reader.rs 89.98% <0.00%> (+0.09%) ⬆️
integration-testing/src/lib.rs 0.00% <0.00%> (ø)
arrow/src/json/reader.rs 84.52% <64.28%> (-0.07%) ⬇️
arrow/src/compute/kernels/cast.rs 95.79% <85.71%> (ø)
arrow/src/array/array_boolean.rs 93.38% <100.00%> (ø)
arrow/src/array/array_dictionary.rs 92.82% <100.00%> (+0.73%) ⬆️
arrow/src/array/array_primitive.rs 95.81% <100.00%> (ø)
... and 34 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 2541e2c...8a4dd03. 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, thanks

@tustvold tustvold added the api-change Changes to the arrow API label Jul 20, 2022
@tustvold tustvold merged commit 8d7e2ae into apache:master Jul 20, 2022
@ursabot
Copy link

ursabot commented Jul 20, 2022

Benchmark runs are scheduled for baseline = b2cf02c and contender = 8d7e2ae. 8d7e2ae 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

@alamb alamb changed the title Make builder append methods infallible where possible Change builder append methods to be infallible where possible Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Several Builder::append methods returning results even though they are infallible
4 participants