crepererum commented on code in PR #4681:
URL: https://github.com/apache/arrow-rs/pull/4681#discussion_r1291217544


##########
arrow-data/src/data.rs:
##########
@@ -1589,10 +1611,13 @@ pub struct DataTypeLayout {
 }
 
 impl DataTypeLayout {
-    /// Describes a basic numeric array where each element has a fixed width
-    pub fn new_fixed_width(byte_width: usize) -> Self {
+    /// Describes a basic numeric array where each element has type `T`
+    pub fn new_fixed_width<T>() -> Self {
         Self {
-            buffers: vec![BufferSpec::FixedWidth { byte_width }],
+            buffers: vec![BufferSpec::FixedWidth {
+                byte_width: mem::size_of::<T>(),
+                alignment: mem::align_of::<T>(),

Review Comment:
   Well let's hope nobody `mmap`s arrow data between different architectures 
w/o carefully thinking about alignment.
   
   On that note: I wonder what the cost would be to heavily overalign buffers 
in general to to make them valid on all supported architectures. Like why not 
just align everything to 256bits?



-- 
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]

Reply via email to