viirya commented on code in PR #3501:
URL: https://github.com/apache/arrow-rs/pull/3501#discussion_r1065197952
##########
arrow-data/src/data.rs:
##########
@@ -463,6 +463,59 @@ impl ArrayData {
size
}
+ pub fn get_slice_memory_size(&self) -> Result<usize, ArrowError> {
+ let mut result: usize = 0;
+ let layout = layout(&self.data_type);
+
+ for spec in layout.buffers.iter() {
+ match spec {
+ BufferSpec::FixedWidth { byte_width } => {
+ let buffer_size = self
+ .len
+ .checked_mul(*byte_width)
+ .expect("integer overflow computing buffer size");
Review Comment:
Instead of panic, it should be better to return `Err`.
--
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]