From d38dd53340122ecff1a95d41b39d77d725fc6054 Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Tue, 23 Jul 2024 22:17:10 +0200 Subject: [PATCH 1/6] changed offset Vector to u64's --- .../polars-arrow/src/compute/cast/utf8_to.rs | 6 ++- crates/polars-row/src/encode.rs | 44 +++++++++++-------- crates/polars-row/src/fixed.rs | 16 +++---- crates/polars-row/src/row.rs | 36 +++++++-------- crates/polars-row/src/variable.rs | 12 ++--- 5 files changed, 62 insertions(+), 52 deletions(-) diff --git a/crates/polars-arrow/src/compute/cast/utf8_to.rs b/crates/polars-arrow/src/compute/cast/utf8_to.rs index 85b478c43817..5658d3e64885 100644 --- a/crates/polars-arrow/src/compute/cast/utf8_to.rs +++ b/crates/polars-arrow/src/compute/cast/utf8_to.rs @@ -83,8 +83,10 @@ type OffsetType = i8; // chunks so that we don't overflow the offset u32. fn truncate_buffer(buf: &Buffer) -> Buffer { // * 2, as it must be able to hold u32::MAX offset + u32::MAX len. - buf.clone() - .sliced(0, std::cmp::min(buf.len(), OffsetType::MAX as usize * 2)) + buf.clone().sliced( + 0, + std::cmp::min(buf.len(), ((OffsetType::MAX as u64) * 2) as usize), + ) } pub fn binary_to_binview(arr: &BinaryArray) -> BinaryViewArray { diff --git a/crates/polars-row/src/encode.rs b/crates/polars-row/src/encode.rs index 00e888c0e9b0..28bfa685926e 100644 --- a/crates/polars-row/src/encode.rs +++ b/crates/polars-row/src/encode.rs @@ -296,7 +296,7 @@ fn allocate_rows_buf( columns: &mut [Encoder], fields: &[EncodingField], values: &mut Vec, - offsets: &mut Vec, + offsets: &mut Vec, ) -> usize { let has_variable = columns.iter().any(|enc| enc.is_variable()); @@ -371,11 +371,11 @@ fn allocate_rows_buf( for opt_val in iter { unsafe { lengths.push_unchecked( - row_size_fixed + (row_size_fixed + crate::variable::encoded_len( opt_val, &EncodingField::new_unsorted(), - ), + )) as u64, ); } } @@ -384,7 +384,7 @@ fn allocate_rows_buf( *row_length += crate::variable::encoded_len( opt_val, &EncodingField::new_unsorted(), - ) + ) as u64 } } processed_count += 1; @@ -397,8 +397,9 @@ fn allocate_rows_buf( for opt_val in array.into_iter() { unsafe { lengths.push_unchecked( - row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field), + (row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field)) + as u64, ); } } @@ -406,7 +407,8 @@ fn allocate_rows_buf( for (opt_val, row_length) in array.into_iter().zip(lengths.iter_mut()) { - *row_length += crate::variable::encoded_len(opt_val, enc_field) + *row_length += + crate::variable::encoded_len(opt_val, enc_field) as u64 } } processed_count += 1; @@ -417,8 +419,9 @@ fn allocate_rows_buf( for opt_val in array.into_iter() { unsafe { lengths.push_unchecked( - row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field), + (row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field)) + as u64, ); } } @@ -426,7 +429,8 @@ fn allocate_rows_buf( for (opt_val, row_length) in array.into_iter().zip(lengths.iter_mut()) { - *row_length += crate::variable::encoded_len(opt_val, enc_field) + *row_length += + crate::variable::encoded_len(opt_val, enc_field) as u64 } } processed_count += 1; @@ -444,14 +448,16 @@ fn allocate_rows_buf( for opt_val in iter { unsafe { lengths.push_unchecked( - row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field), + (row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field)) + as u64, ) } } } else { for (opt_val, row_length) in iter.zip(lengths.iter_mut()) { - *row_length += crate::variable::encoded_len(opt_val, enc_field) + *row_length += + crate::variable::encoded_len(opt_val, enc_field) as u64 } } processed_count += 1; @@ -472,12 +478,12 @@ fn allocate_rows_buf( for length in offsets.iter_mut() { let to_write = lagged_offset; lagged_offset = current_offset; - current_offset += *length; + current_offset += *length as usize; - *length = to_write; + *length = to_write as u64; } // ensure we have len + 1 offsets - offsets.push(lagged_offset); + offsets.push(lagged_offset as u64); // Only reserve. The init will be done later values.reserve(current_offset); @@ -505,10 +511,10 @@ fn allocate_rows_buf( // 0, 2, 4, 6 offsets.clear(); offsets.reserve(num_rows + 1); - let mut current_offset = 0; - offsets.push(current_offset); + let mut current_offset = 0_usize; + offsets.push(current_offset as u64); for _ in 0..num_rows { - offsets.push(current_offset); + offsets.push(current_offset as u64); current_offset += row_size; } n_bytes diff --git a/crates/polars-row/src/fixed.rs b/crates/polars-row/src/fixed.rs index f9bdc4394b08..d8ee3b0d3cf8 100644 --- a/crates/polars-row/src/fixed.rs +++ b/crates/polars-row/src/fixed.rs @@ -144,12 +144,12 @@ impl FixedLengthEncoding for f64 { #[inline] fn encode_value( value: &T, - offset: &mut usize, + offset: &mut u64, descending: bool, buf: &mut [MaybeUninit], ) { - let end_offset = *offset + T::ENCODED_LEN; - let dst = unsafe { buf.get_unchecked_release_mut(*offset..end_offset) }; + let end_offset = *offset as usize + T::ENCODED_LEN; + let dst = unsafe { buf.get_unchecked_release_mut((*offset as usize)..end_offset) }; // set valid dst[0] = MaybeUninit::new(1); let mut encoded = value.encode(); @@ -162,7 +162,7 @@ fn encode_value( } dst[1..].copy_from_slice(encoded.as_ref().as_uninit()); - *offset = end_offset; + *offset = end_offset as u64; } pub(crate) unsafe fn encode_slice( @@ -198,16 +198,16 @@ pub(crate) unsafe fn encode_iter>, T: FixedLengthEn encode_value(&value, offset, field.descending, values); } else { unsafe { - *values.get_unchecked_release_mut(*offset) = + *values.get_unchecked_release_mut(*offset as usize) = MaybeUninit::new(get_null_sentinel(field)) }; - let end_offset = *offset + T::ENCODED_LEN; + let end_offset = *offset as usize + T::ENCODED_LEN; // initialize remaining bytes - let remainder = values.get_unchecked_release_mut(*offset + 1..end_offset); + let remainder = values.get_unchecked_release_mut((*offset as usize) + 1..end_offset); remainder.fill(MaybeUninit::new(0)); - *offset = end_offset; + *offset = end_offset as u64; } } } diff --git a/crates/polars-row/src/row.rs b/crates/polars-row/src/row.rs index d48f6f51c205..4b180edb7760 100644 --- a/crates/polars-row/src/row.rs +++ b/crates/polars-row/src/row.rs @@ -35,26 +35,23 @@ impl EncodingField { #[derive(Default, Clone)] pub struct RowsEncoded { pub(crate) values: Vec, - pub(crate) offsets: Vec, + + // This vector is in practice a vec of usize's. + // However, since the vec is eventually passed to arrow as i64's, + // we need to make sure the right number of bytes are reserved. + // Usize's take 4 bytes of memory, whereas i64 takes 8 bytes. + pub(crate) offsets: Vec, } -fn checks(offsets: &[usize]) { - assert_eq!( - std::mem::size_of::(), - std::mem::size_of::(), - "only supported on 64bit arch" - ); - assert!( - (*offsets.last().unwrap() as u64) < i64::MAX as u64, - "overflow" - ); +fn checks(offsets: &[u64]) { + assert!(*offsets.last().unwrap() < i64::MAX as u64, "overflow"); } -unsafe fn rows_to_array(buf: Vec, offsets: Vec) -> BinaryArray { +unsafe fn rows_to_array(buf: Vec, offsets: Vec) -> BinaryArray { checks(&offsets); // SAFETY: we checked overflow - let offsets = bytemuck::cast_vec::(offsets); + let offsets = bytemuck::cast_vec::(offsets); // SAFETY: monotonically increasing let offsets = Offsets::new_unchecked(offsets); @@ -63,7 +60,7 @@ unsafe fn rows_to_array(buf: Vec, offsets: Vec) -> BinaryArray { } impl RowsEncoded { - pub(crate) fn new(values: Vec, offsets: Vec) -> Self { + pub(crate) fn new(values: Vec, offsets: Vec) -> Self { RowsEncoded { values, offsets } } @@ -87,7 +84,7 @@ impl RowsEncoded { unsafe { let (_, values, _) = mmap::slice(&self.values).into_inner(); - let offsets = bytemuck::cast_slice::(self.offsets.as_slice()); + let offsets = bytemuck::cast_slice::(self.offsets.as_slice()); let (_, offsets, _) = mmap::slice(offsets).into_inner(); let offsets = OffsetsBuffer::new_unchecked(offsets); @@ -114,8 +111,8 @@ impl RowsEncoded { } pub struct RowsEncodedIter<'a> { - offset: usize, - end: std::slice::Iter<'a, usize>, + offset: u64, + end: std::slice::Iter<'a, u64>, values: &'a [u8], } @@ -124,7 +121,10 @@ impl<'a> Iterator for RowsEncodedIter<'a> { fn next(&mut self) -> Option { let new_offset = *self.end.next()?; - let payload = unsafe { self.values.get_unchecked(self.offset..new_offset) }; + let payload = unsafe { + self.values + .get_unchecked((self.offset as usize)..(new_offset as usize)) + }; self.offset = new_offset; Some(payload) } diff --git a/crates/polars-row/src/variable.rs b/crates/polars-row/src/variable.rs index 5032e41085a8..2bc07b94d77a 100644 --- a/crates/polars-row/src/variable.rs +++ b/crates/polars-row/src/variable.rs @@ -203,19 +203,21 @@ pub(crate) unsafe fn encode_iter<'a, I: Iterator>>( if field.no_order { for (offset, opt_value) in out.offsets.iter_mut().skip(1).zip(input) { - let dst = values.get_unchecked_release_mut(*offset..); + let dst: &mut [MaybeUninit] = + values.get_unchecked_release_mut((*offset as usize)..); let written_len = encode_one_no_order(dst, opt_value.map(|v| v.as_uninit()), field); - *offset += written_len; + *offset += written_len as u64; } } else { for (offset, opt_value) in out.offsets.iter_mut().skip(1).zip(input) { - let dst = values.get_unchecked_release_mut(*offset..); + let dst: &mut [MaybeUninit] = + values.get_unchecked_release_mut((*offset as usize)..); let written_len = encode_one(dst, opt_value.map(|v| v.as_uninit()), field); - *offset += written_len; + *offset += written_len as u64; } } let offset = out.offsets.last().unwrap(); - let dst = values.get_unchecked_release_mut(*offset..); + let dst: &mut [MaybeUninit] = values.get_unchecked_release_mut((*offset as usize)..); // write remainder as zeros dst.fill(MaybeUninit::new(0)); out.values.set_len(out.values.capacity()) From 6942eb8dbe98504699e728374171041733dd366e Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Tue, 23 Jul 2024 22:26:03 +0200 Subject: [PATCH 2/6] reverted some changes from usize to u64 --- crates/polars-row/src/row.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/polars-row/src/row.rs b/crates/polars-row/src/row.rs index 4b180edb7760..01db2791be5f 100644 --- a/crates/polars-row/src/row.rs +++ b/crates/polars-row/src/row.rs @@ -66,7 +66,7 @@ impl RowsEncoded { pub fn iter(&self) -> RowsEncodedIter { let iter = self.offsets[1..].iter(); - let offset = self.offsets[0]; + let offset = self.offsets[0] as usize; RowsEncodedIter { offset, end: iter, @@ -111,7 +111,7 @@ impl RowsEncoded { } pub struct RowsEncodedIter<'a> { - offset: u64, + offset: usize, end: std::slice::Iter<'a, u64>, values: &'a [u8], } @@ -120,11 +120,8 @@ impl<'a> Iterator for RowsEncodedIter<'a> { type Item = &'a [u8]; fn next(&mut self) -> Option { - let new_offset = *self.end.next()?; - let payload = unsafe { - self.values - .get_unchecked((self.offset as usize)..(new_offset as usize)) - }; + let new_offset = *self.end.next()? as usize; + let payload = unsafe { self.values.get_unchecked(self.offset..new_offset) }; self.offset = new_offset; Some(payload) } From 6c17756e0281cc0d03e90f5f137f87b089d7a5a5 Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Fri, 26 Jul 2024 09:58:05 +0200 Subject: [PATCH 3/6] splitted out casting and variable assignment to improve readability. --- crates/polars-row/src/encode.rs | 36 +++++++++------------------------ crates/polars-row/src/fixed.rs | 10 +++++---- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/crates/polars-row/src/encode.rs b/crates/polars-row/src/encode.rs index 28bfa685926e..d2b536c12dab 100644 --- a/crates/polars-row/src/encode.rs +++ b/crates/polars-row/src/encode.rs @@ -369,22 +369,15 @@ fn allocate_rows_buf( if processed_count == 0 { for opt_val in iter { + let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, &EncodingField::new_unsorted()); unsafe { - lengths.push_unchecked( - (row_size_fixed - + crate::variable::encoded_len( - opt_val, - &EncodingField::new_unsorted(), - )) as u64, - ); + lengths.push_unchecked(next_length as u64); } } } else { for (opt_val, row_length) in iter.zip(lengths.iter_mut()) { - *row_length += crate::variable::encoded_len( - opt_val, - &EncodingField::new_unsorted(), - ) as u64 + let next_length = crate::variable::encoded_len(opt_val, &EncodingField::new_unsorted()); + *row_length += next_length as u64 } } processed_count += 1; @@ -395,12 +388,9 @@ fn allocate_rows_buf( let array = array.as_any().downcast_ref::().unwrap(); if processed_count == 0 { for opt_val in array.into_iter() { + let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); unsafe { - lengths.push_unchecked( - (row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field)) - as u64, - ); + lengths.push_unchecked(next_length as u64); } } } else { @@ -417,12 +407,9 @@ fn allocate_rows_buf( let array = array.as_any().downcast_ref::>().unwrap(); if processed_count == 0 { for opt_val in array.into_iter() { + let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); unsafe { - lengths.push_unchecked( - (row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field)) - as u64, - ); + lengths.push_unchecked(next_length as u64); } } } else { @@ -446,12 +433,9 @@ fn allocate_rows_buf( .map(|opt_s| opt_s.map(|s| s.as_bytes())); if processed_count == 0 { for opt_val in iter { + let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); unsafe { - lengths.push_unchecked( - (row_size_fixed - + crate::variable::encoded_len(opt_val, enc_field)) - as u64, - ) + lengths.push_unchecked(next_length as u64) } } } else { diff --git a/crates/polars-row/src/fixed.rs b/crates/polars-row/src/fixed.rs index d8ee3b0d3cf8..c604637d0522 100644 --- a/crates/polars-row/src/fixed.rs +++ b/crates/polars-row/src/fixed.rs @@ -148,8 +148,9 @@ fn encode_value( descending: bool, buf: &mut [MaybeUninit], ) { - let end_offset = *offset as usize + T::ENCODED_LEN; - let dst = unsafe { buf.get_unchecked_release_mut((*offset as usize)..end_offset) }; + let usize_offset = *offset as usize; + let end_offset = usize_offset + T::ENCODED_LEN; + let dst = unsafe { buf.get_unchecked_release_mut(usize_offset..end_offset) }; // set valid dst[0] = MaybeUninit::new(1); let mut encoded = value.encode(); @@ -201,10 +202,11 @@ pub(crate) unsafe fn encode_iter>, T: FixedLengthEn *values.get_unchecked_release_mut(*offset as usize) = MaybeUninit::new(get_null_sentinel(field)) }; - let end_offset = *offset as usize + T::ENCODED_LEN; + let usize_offset = *offset as usize; + let end_offset = usize_offset + T::ENCODED_LEN; // initialize remaining bytes - let remainder = values.get_unchecked_release_mut((*offset as usize) + 1..end_offset); + let remainder = values.get_unchecked_release_mut(usize_offset + 1..end_offset); remainder.fill(MaybeUninit::new(0)); *offset = end_offset as u64; From acf11f9d17d5788a4c558614b06ed850b7773b66 Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Fri, 26 Jul 2024 10:08:07 +0200 Subject: [PATCH 4/6] linting amd small readability improvements --- crates/polars-row/src/encode.rs | 24 ++++++++++++++++-------- crates/polars-row/src/fixed.rs | 5 +++-- crates/polars-row/src/row.rs | 2 +- crates/polars-row/src/variable.rs | 4 ++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/crates/polars-row/src/encode.rs b/crates/polars-row/src/encode.rs index d2b536c12dab..4d5bccd4eb88 100644 --- a/crates/polars-row/src/encode.rs +++ b/crates/polars-row/src/encode.rs @@ -369,14 +369,21 @@ fn allocate_rows_buf( if processed_count == 0 { for opt_val in iter { - let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, &EncodingField::new_unsorted()); + let next_length = row_size_fixed + + crate::variable::encoded_len( + opt_val, + &EncodingField::new_unsorted(), + ); unsafe { lengths.push_unchecked(next_length as u64); } } } else { for (opt_val, row_length) in iter.zip(lengths.iter_mut()) { - let next_length = crate::variable::encoded_len(opt_val, &EncodingField::new_unsorted()); + let next_length = crate::variable::encoded_len( + opt_val, + &EncodingField::new_unsorted(), + ); *row_length += next_length as u64 } } @@ -388,7 +395,8 @@ fn allocate_rows_buf( let array = array.as_any().downcast_ref::().unwrap(); if processed_count == 0 { for opt_val in array.into_iter() { - let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); + let next_length = row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field); unsafe { lengths.push_unchecked(next_length as u64); } @@ -407,7 +415,8 @@ fn allocate_rows_buf( let array = array.as_any().downcast_ref::>().unwrap(); if processed_count == 0 { for opt_val in array.into_iter() { - let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); + let next_length = row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field); unsafe { lengths.push_unchecked(next_length as u64); } @@ -433,10 +442,9 @@ fn allocate_rows_buf( .map(|opt_s| opt_s.map(|s| s.as_bytes())); if processed_count == 0 { for opt_val in iter { - let next_length = row_size_fixed + crate::variable::encoded_len(opt_val, enc_field); - unsafe { - lengths.push_unchecked(next_length as u64) - } + let next_length = row_size_fixed + + crate::variable::encoded_len(opt_val, enc_field); + unsafe { lengths.push_unchecked(next_length as u64) } } } else { for (opt_val, row_length) in iter.zip(lengths.iter_mut()) { diff --git a/crates/polars-row/src/fixed.rs b/crates/polars-row/src/fixed.rs index c604637d0522..f62b6edf3455 100644 --- a/crates/polars-row/src/fixed.rs +++ b/crates/polars-row/src/fixed.rs @@ -198,11 +198,12 @@ pub(crate) unsafe fn encode_iter>, T: FixedLengthEn if let Some(value) = opt_value { encode_value(&value, offset, field.descending, values); } else { + let usize_offset = *offset as usize; unsafe { - *values.get_unchecked_release_mut(*offset as usize) = + *values.get_unchecked_release_mut(usize_offset) = MaybeUninit::new(get_null_sentinel(field)) }; - let usize_offset = *offset as usize; + let end_offset = usize_offset + T::ENCODED_LEN; // initialize remaining bytes diff --git a/crates/polars-row/src/row.rs b/crates/polars-row/src/row.rs index 01db2791be5f..a991791963f6 100644 --- a/crates/polars-row/src/row.rs +++ b/crates/polars-row/src/row.rs @@ -39,7 +39,7 @@ pub struct RowsEncoded { // This vector is in practice a vec of usize's. // However, since the vec is eventually passed to arrow as i64's, // we need to make sure the right number of bytes are reserved. - // Usize's take 4 bytes of memory, whereas i64 takes 8 bytes. + // Usize's take 4 bytes of memory on 32bit systems, whereas i64 takes 8 bytes. pub(crate) offsets: Vec, } diff --git a/crates/polars-row/src/variable.rs b/crates/polars-row/src/variable.rs index 2bc07b94d77a..24c31489e5a1 100644 --- a/crates/polars-row/src/variable.rs +++ b/crates/polars-row/src/variable.rs @@ -216,8 +216,8 @@ pub(crate) unsafe fn encode_iter<'a, I: Iterator>>( *offset += written_len as u64; } } - let offset = out.offsets.last().unwrap(); - let dst: &mut [MaybeUninit] = values.get_unchecked_release_mut((*offset as usize)..); + let offset = *out.offsets.last().unwrap() as usize; + let dst: &mut [MaybeUninit] = values.get_unchecked_release_mut(offset..); // write remainder as zeros dst.fill(MaybeUninit::new(0)); out.values.set_len(out.values.capacity()) From dd04613c4159e4c95f40ae1caa04585a41299af1 Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Mon, 23 Sep 2024 23:17:59 +0200 Subject: [PATCH 5/6] linting amd small readability improvements --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index e83ff50bdbcc..92604f563ed4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3623,7 +3623,7 @@ dependencies = [ [[package]] name = "py-polars" -version = "1.8.0" +version = "1.8.1" dependencies = [ "built", "jemallocator", From f1fc25f6f3e29fcf24794e5c4422fb93bd4f3e19 Mon Sep 17 00:00:00 2001 From: Niels Drost Date: Thu, 14 Nov 2024 22:21:18 +0100 Subject: [PATCH 6/6] merge main --- crates/polars-row/src/encode.rs | 2 +- crates/polars-row/src/fixed.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/polars-row/src/encode.rs b/crates/polars-row/src/encode.rs index d92d9dce9449..275699cc909a 100644 --- a/crates/polars-row/src/encode.rs +++ b/crates/polars-row/src/encode.rs @@ -378,7 +378,7 @@ fn allocate_rows_buf( } } else { for (opt_val, row_length) in iter.zip(lengths.iter_mut()) { - *row_length += crate::variable::encoded_len(opt_val, &field) + *row_length += crate::variable::encoded_len(opt_val, &field) as u64; } } processed_count += 1; diff --git a/crates/polars-row/src/fixed.rs b/crates/polars-row/src/fixed.rs index ed4c48946445..bec427b0e86f 100644 --- a/crates/polars-row/src/fixed.rs +++ b/crates/polars-row/src/fixed.rs @@ -200,13 +200,13 @@ pub(crate) unsafe fn encode_iter>, T: FixedLengthEn } else { let usize_offset = *offset as usize; unsafe { - *values.get_unchecked_mut(*usize_offset) = MaybeUninit::new(get_null_sentinel(field)) + *values.get_unchecked_mut(usize_offset) = MaybeUninit::new(get_null_sentinel(field)) }; let end_offset = usize_offset + T::ENCODED_LEN; // initialize remaining bytes - let remainder = values.get_unchecked_mut(*usize_offset + 1..end_offset); + let remainder = values.get_unchecked_mut(usize_offset + 1..end_offset); remainder.fill(MaybeUninit::new(0)); *offset = end_offset as u64;