You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/06/26 11:30:19 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4446: Revise error message in From for ScalaBuffer

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org