jhorstmann commented on pull request #9413:
URL: https://github.com/apache/arrow/pull/9413#issuecomment-773207915


   I think the compiler should be able to prove most of those assertions 
statically, so maybe we don't need an unsafe variant and could leave the 
assertions in.
   
   For example, when the buffer is created via `from_trusted_len_iter`, that 
method calculates the length by multiplying with `size_of::<T>()` and allocates 
and writes into a suitable aligned buffer. This knowledge should allow the 
compiler to remove the corresponding assertions in `ArrayData::new_primitive`.
   
   For further simplification, we could maybe remove the `offset` parameter 
here, I see it is 0 in all usages of this PR. If we leave it in, we should add 
a test with a non-zero offset, as I'm not convinced the logic is correct.


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to