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

fix(rust): Fix inconsistency between code and comment #19810

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/polars-arrow/src/array/primitive/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl<T: NativeType> MutablePrimitiveArray<T> {

/// Sets values.
/// # Panic
/// Panics iff the values' length is not equal to the existing validity's len.
/// Panics iff the values' length is not equal to the existing values' len.
pub fn set_values(&mut self, values: Vec<T>) {
assert_eq!(values.len(), self.values.len());
self.values = values;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-core/src/chunked_array/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where

/// Sets the validity of this array.
/// # Panics
/// This function panics iff `values.len() != self.len()`.
/// This function panics iff `validity.len() != self.len()`.
#[inline]
pub fn set_validity(&mut self, validity: Option<Bitmap>) {
if matches!(&validity, Some(bitmap) if bitmap.len() != self.len()) {
Expand Down
1 change: 1 addition & 0 deletions crates/polars-parquet/src/parquet/encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub use crate::parquet::parquet_bridge::Encoding;
/// This function panics iff `values.len() < 4`.
#[inline]
pub fn get_length(values: &[u8]) -> Option<usize> {
assert!(values.len() >= 4);
values
.get(0..4)
.map(|x| u32::from_le_bytes(x.try_into().unwrap()) as usize)
Expand Down
1 change: 1 addition & 0 deletions crates/polars-parquet/src/parquet/encoding/uleb128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub fn decode(values: &[u8]) -> (u64, usize) {
/// # Panic
/// This function may panic if `container.len() < 10` and `value` requires more bytes.
pub fn encode(mut value: u64, container: &mut [u8]) -> usize {
assert!(container.len() >= 10);
let mut consumed = 0;
let mut iter = container.iter_mut();
loop {
Expand Down
Loading