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

Tweak Private Sbbf::new_with_ndv_fpp Documentation #5718

Merged
merged 3 commits into from
May 4, 2024

Conversation

YichiZhang0613
Copy link
Contributor

Closes #5708.

I solve some inconsistency between code and comment and add some checks for boundary constraints mentioned in comment.

@github-actions github-actions bot added parquet Changes to the parquet crate arrow Changes to the arrow crate labels May 4, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution @YichiZhang0613 🙏

I think the asserts in this PR are unecessary as Rust automatically checks bounds on array accesses (and panic's if it is out of bounds)

@@ -232,6 +232,7 @@ impl<T: ByteArrayType> GenericByteArray<T> {
#[inline]
pub fn value_length(&self, i: usize) -> T::Offset {
let offsets = self.value_offsets();
assert!(i + 1 < offsets.len());
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 this check is unecessary as offsets[i + 1] will panic if the access is out of bounds

@@ -645,6 +645,8 @@ impl<'a> MutableArrayData<'a> {
/// or `end` > the length of the `index`th array
pub fn extend(&mut self, index: usize, start: usize, end: usize) {
let len = end - start;
assert!(index < self.extend_null_bits.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

These are also unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I will modify my PR accordingly.

@YichiZhang0613
Copy link
Contributor Author

ok, I will modify my PR accordingly.

@github-actions github-actions bot removed the arrow Changes to the arrow crate label May 4, 2024
@tustvold tustvold added documentation Improvements or additions to documentation development-process Related to development process of arrow-rs labels May 4, 2024
@tustvold tustvold changed the title Solve inconsistency between code and comment Tweak Crate-Private Sbbf::new_with_ndv_fpp Documentation May 4, 2024
@@ -179,7 +179,7 @@ fn num_of_bits_from_ndv_fpp(ndv: u64, fpp: f64) -> usize {

impl Sbbf {
/// Create a new [Sbbf] with given number of distinct values and false positive probability.
/// Will panic if `fpp` is greater than 1.0 or less than 0.0.
/// Will panic if `fpp` is greater than or equal to 1.0 or less than 0.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Will panic if `fpp` is greater than or equal to 1.0 or less than 0.0.
/// Will return an error if `fpp` is greater than or equal to 1.0 or less than 0.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I will modify my PR accordingly.

@tustvold tustvold changed the title Tweak Crate-Private Sbbf::new_with_ndv_fpp Documentation Tweak Private Sbbf::new_with_ndv_fpp Documentation May 4, 2024
@tustvold tustvold merged commit 0d0c02e into apache:master May 4, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development-process Related to development process of arrow-rs documentation Improvements or additions to documentation parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency between code and comment
3 participants