alamb commented on code in PR #6244:
URL: https://github.com/apache/arrow-rs/pull/6244#discussion_r1715973661


##########
parquet/src/arrow/array_reader/fixed_len_byte_array.rs:
##########
@@ -165,57 +165,65 @@ impl ArrayReader for FixedLenByteArrayReader {
         // TODO: An improvement might be to do this conversion on read
         let array: ArrayRef = match &self.data_type {
             ArrowType::Decimal128(p, s) => {
-                let decimal = binary
-                    .iter()
-                    .map(|opt| Some(i128::from_be_bytes(sign_extend_be(opt?))))
-                    .collect::<Decimal128Array>()
+                let nulls = binary.nulls().cloned();
+                let decimal = binary.iter().map(|o| match o {

Review Comment:
   >  it would be nice to have something like unary that consumes self so we 
can just take the null buffer rather than cloning it.
   
   You can split the array into null buffer and scalar buffer with 
`array.into_parts()` I think
   
   I have often thought it would be nice to add a method like this to 
PrimiveArray to assist with null shenanigans
   
   ```rust
   struct PrimitiveArray {
   
     /// Replace the null buffer of this array with the specified buffer
     pub fn with_nulls(mut self, nulls: Option<NullBuffer>) -> Self {
       ..
     }
   }
   ```



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