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 validation for Decimal256 #2113

Merged
merged 5 commits into from Jul 22, 2022
Merged

Conversation

viirya
Copy link
Member

@viirya viirya commented Jul 20, 2022

Which issue does this PR close?

Closes #2112.

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 20, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2022

Codecov Report

Merging #2113 (b060eb2) into master (db91031) will decrease coverage by 0.00%.
The diff coverage is 80.64%.

@@            Coverage Diff             @@
##           master    #2113      +/-   ##
==========================================
- Coverage   83.71%   83.70%   -0.01%     
==========================================
  Files         225      225              
  Lines       59563    59625      +62     
==========================================
+ Hits        49862    49911      +49     
- Misses       9701     9714      +13     
Impacted Files Coverage Δ
arrow/src/array/array_decimal.rs 91.03% <ø> (ø)
arrow/src/datatypes/datatype.rs 62.69% <60.71%> (-0.54%) ⬇️
arrow/src/array/data.rs 84.90% <88.88%> (+0.02%) ⬆️
arrow/src/array/builder/decimal_builder.rs 86.13% <100.00%> (+3.09%) ⬆️
parquet_derive/src/parquet_field.rs 65.98% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

@@ -298,6 +299,49 @@ pub const MAX_DECIMAL_FOR_EACH_PRECISION: [i128; 38] = [
99999999999999999999999999999999999999,
];

/// `MAX_DECIMAL_FOR_LARGER_PRECISION[p]` holds the maximum integer value
/// that can be stored in [DataType::Decimal256] value of precision `p` > 38
Copy link
Member Author

Choose a reason for hiding this comment

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

Depends on #2093 which adds DataType::Decimal256

Copy link
Member Author

Choose a reason for hiding this comment

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

So this causes doc failure in CI.

Copy link
Contributor

@alamb alamb Jul 21, 2022

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 merging the latest apache/master into this PR

@@ -1018,6 +1018,7 @@ impl ArrayData {
}
Ok(())
}
// TODO: call validate_decimal256_precision for Decimal256 type
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still a TODO for this PR?

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 was waiting for #2093 where added Decimal256 type, so I can call validate_decimal256_precision here. Let me update this.

@@ -352,7 +352,7 @@ impl From<ArrayData> for Decimal256Array {
assert_eq!(
data.buffers().len(),
1,
"Decimal128Array data should contain 1 buffer only (values)"
"Decimal256Array data should contain 1 buffer only (values)"
Copy link
Member Author

Choose a reason for hiding this comment

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

fix typo

Comment on lines 643 to 646
b.append_value(&decimal)?
}
_ => b.append_null(),
}?;
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why this was not caught in CI previously.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was a logical conflict: #2121

@viirya viirya merged commit 34f58f9 into apache:master Jul 22, 2022
@viirya
Copy link
Member Author

viirya commented Jul 22, 2022

Thanks @alamb

@ursabot
Copy link

ursabot commented Jul 22, 2022

Benchmark runs are scheduled for baseline = c3e019f and contender = 34f58f9. 34f58f9 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.

Do value validation for Decimal256
4 participants