-
Notifications
You must be signed in to change notification settings - Fork 833
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
Conversation
There was a problem hiding this 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)
arrow-array/src/array/byte_array.rs
Outdated
@@ -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()); |
There was a problem hiding this comment.
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
arrow-data/src/transform/mod.rs
Outdated
@@ -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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are also unnecessary
There was a problem hiding this comment.
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.
ok, I will modify my PR accordingly. |
parquet/src/bloom_filter/mod.rs
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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. |
There was a problem hiding this comment.
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.
Closes #5708.
I solve some inconsistency between code and comment and add some checks for boundary constraints mentioned in comment.