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

Refactoring DecimalBuilder constructors #2517

Merged
merged 5 commits into from Aug 20, 2022

Conversation

psvri
Copy link
Contributor

@psvri psvri commented Aug 19, 2022

Which issue does this PR close?

Partially implements #2054

Rationale for this change

Refactor apis to make a consistent new and with_capacity functions

What changes are included in this PR?

Removes capacity from new and added with_capacity function instead.

Are there any user-facing changes?

Yes

@psvri psvri marked this pull request as draft August 19, 2022 08:54
@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 19, 2022
@psvri psvri changed the title refactoring decimal builder apis Refactoring DecimalBuilder constructors Aug 19, 2022
@psvri psvri marked this pull request as ready for review August 19, 2022 16:59
Copy link
Contributor

@HaoYang670 HaoYang670 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 69 to 70
/// Creates a new [`Decimal128Builder`], `capacity` is the number of bytes in the values
/// array
Copy link
Contributor

@tustvold tustvold Aug 20, 2022

Choose a reason for hiding this comment

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

This needs to change the definition of capacity to be the number of decimal elements, instead of the number of decimal bytes. Eliminating this inconsistency is the major motivator for #2054

Copy link
Contributor

Choose a reason for hiding this comment

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

It occurs to me I didn't catch this on #2516 ....

Copy link
Contributor

Choose a reason for hiding this comment

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

I took the liberty of fixing this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you

Box::new(Decimal128Builder::new(capacity, *precision, *scale))
}
DataType::Decimal128(precision, scale) => Box::new(
Decimal128Builder::with_capacity(capacity, *precision, *scale),
Copy link
Contributor

Choose a reason for hiding this comment

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

It turns out a lot of callsites were assuming this capacity was in terms of elements, when in actuality it was in terms of bytes (which was an extremely confusing API)

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

ursabot commented Aug 20, 2022

Benchmark runs are scheduled for baseline = 9921cd5 and contender = 65cae43. 65cae43 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

@psvri
Copy link
Contributor Author

psvri commented Aug 20, 2022

Just curious , how can we see ursa bots benchmarks for the merges.

@tustvold
Copy link
Contributor

I don't believe ursabot is currently setup to work with the Rust repo, I think someone got part way through integrating it, so it comments on the PRs but doesn't actually do anything 😅

@psvri
Copy link
Contributor Author

psvri commented Aug 20, 2022

Okay

@psvri psvri deleted the decimal_builder_refactor branch September 6, 2022 12:39
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants