tustvold commented on code in PR #4446:
URL: https://github.com/apache/arrow-rs/pull/4446#discussion_r1242051875
##########
arrow-buffer/src/buffer/scalar.rs:
##########
@@ -118,11 +119,16 @@ impl<T: ArrowNativeType> From<MutableBuffer> for
ScalarBuffer<T> {
impl<T: ArrowNativeType> From<Buffer> for ScalarBuffer<T> {
fn from(buffer: Buffer) -> Self {
let align = std::mem::align_of::<T>();
- assert_eq!(
- buffer.as_ptr().align_offset(align),
- 0,
- "memory is not aligned"
- );
+ let is_aligned = buffer.as_ptr().align_offset(align) == 0;
+
+ match buffer.deallocation() {
+ Deallocation::Standard(_) => assert!(
+ is_aligned,
+ "Memory pointer is not aligned with the specified scalar type."
Review Comment:
```suggestion
"Memory pointer is not aligned with the specified scalar
type"
```
--
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]