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

Collocate Decimal Array Validation Logic #2446

Merged
merged 2 commits into from Aug 17, 2022

Conversation

liukun4515
Copy link
Contributor

@liukun4515 liukun4515 commented Aug 14, 2022

Which issue does this PR close?

Closes #2447

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@HaoYang670
Copy link
Contributor

Please add some description if this PR has been ready for review. Thank you.

@liukun4515
Copy link
Contributor Author

Please add some description if this PR has been ready for review. Thank you.

tracked a issue to describe what the pr solves

.unwrap()
.validate_decimal_precision(precision),
other_width => {
panic!("invalid byte width {}", other_width);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you test that if this is a compile error or a runtime error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't test this error.
Guess this is a runtime error, when use BasicDecimalArray<OTHER_WIDTH> to call this method.

@liukun4515
Copy link
Contributor Author

@alamb @tustvold PTAL

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 makes sense to me, although I do wonder if validation of this form really belongs in ArrayData

.as_any()
.downcast_ref::<Decimal256Array>()
.unwrap()
.validate_decimal_precision(precision),
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 this logic should live in ArrayData, where all the rest of the validation logic lives?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

some usage of

new_self.validate_full().unwrap();

new_self.validate_full()?;

pub fn validate_values(&self) -> Result<()> {

I will go through the usage, and check if it is necessary or not

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm suggesting that rather than this PR implementing additional validation, it should just use the validation logic that already exists in ArrayData?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds great, maybe I can try it in the follow up pr.
we remain the original logic and just refactor this struct and impl now
I just concerned about the performance of the ArrayData. We have the benchmark which can be used to bench it easily.

@alamb add the validation for decimalarray with_precision_scale, I also have the same question. Why not we use the logic in the ArrayData?

Copy link
Contributor

Choose a reason for hiding this comment

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

Consolidating validation in ArrayData sounds like a great plan to me. I can't remember any particular reason it isn't there

@tustvold tustvold changed the title collation the validate precision code for decimal array Collocate Decimal Array Validation Logic Aug 17, 2022
@liukun4515 liukun4515 merged commit 0013170 into apache:master Aug 17, 2022
@ursabot
Copy link

ursabot commented Aug 17, 2022

Benchmark runs are scheduled for baseline = 2185ce2 and contender = 0013170. 0013170 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
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combine DecimalArray validation
5 participants