tustvold commented on code in PR #4681:
URL: https://github.com/apache/arrow-rs/pull/4681#discussion_r1291208297
##########
arrow-data/src/data.rs:
##########
@@ -736,17 +753,25 @@ impl ArrayData {
self.buffers.iter().zip(layout.buffers.iter()).enumerate()
{
match spec {
- BufferSpec::FixedWidth { byte_width } => {
- let min_buffer_size = len_plus_offset
- .checked_mul(*byte_width)
- .expect("integer overflow computing min buffer size");
+ BufferSpec::FixedWidth {
+ byte_width,
+ alignment,
+ } => {
+ let min_buffer_size =
len_plus_offset.saturating_mul(*byte_width);
if buffer.len() < min_buffer_size {
return Err(ArrowError::InvalidArgumentError(format!(
"Need at least {} bytes in buffers[{}] in array of
type {:?}, but got {}",
min_buffer_size, i, self.data_type, buffer.len()
)));
}
+
+ if buffer.as_ptr().align_offset(*alignment) != 0 {
Review Comment:
We now actually verify this as part of ArrayData, instead of panicking when
you try to create an array :tada:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]