๐๐ฎ๐๐ฎ, ๐๐ป๐ฎ๐น๐๐๐ถ๐ฐ๐ & ๐๐. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
Similar to #15162, I found some inconsistency between code and comment.
In databend-main/src/common/arrow/src/arrow/array/union/mod.rs๏ผcomment should be "offset + length > self.len()"
/// # Panic
/// This function panics iff `offset + length >= self.len()`.
#[inline]
pub fn slice(&mut self, offset: usize, length: usize) {
assert!(
offset + length <= self.len(),
"the offset of the new array cannot exceed the existing length"
);
unsafe { self.slice_unchecked(offset, length) }
}
In databend-main/src/common/arrow/src/arrow/array/primitive/mutable.rs, comment should be "index is larger than or equal to `self.len()"
/// # Panic
/// Panics iff index is larger than `self.len()`.
pub fn set(&mut self, index: usize, value: Option<T>) {
assert!(index < self.len());
In databend-main/src/common/arrow/src/arrow/buffer/immutable.rs, maybe the comment should be "Panics iff offset + length is larger than len"
/// # Panics
/// Panics iff `offset` is larger than `len`.
#[inline]
pub fn slice(&mut self, offset: usize, length: usize) {
assert!(
offset + length <= self.len(),
"the offset of the new Buffer cannot exceed the existing length"
);
// Safety: we just checked bounds
unsafe { self.slice_unchecked(offset, length) }
}
and some unchecked boundary or empty constraints which are indicated in comment while aren't checked in code.For example, in databend-main/src/common/arrow/src/arrow/io/ipc/read/file.rs, the code should check whether index is out of bounds before using it directly.
Similar to #15162, I found some inconsistency between code and comment. In databend-main/src/common/arrow/src/arrow/array/union/mod.rs๏ผcomment should be "offset + length > self.len()"
In databend-main/src/common/arrow/src/arrow/array/primitive/mutable.rs, comment should be "index is larger than or equal to `self.len()"
In databend-main/src/common/arrow/src/arrow/buffer/immutable.rs, maybe the comment should be "Panics iff
offset + length
is larger thanlen
"and some unchecked boundary or empty constraints which are indicated in comment while aren't checked in code.For example, in databend-main/src/common/arrow/src/arrow/io/ipc/read/file.rs, the code should check whether index is out of bounds before using it directly.