sweb opened a new pull request #8640:
URL: https://github.com/apache/arrow/pull/8640


   This is very much work in progress.
   
   The idea is to implement `DecimalArray` based on the existing 
`FixedSizeBinaryArray`. At the current state this is mostly C&P. The values are 
returned as `i128`. The underlying fixed size is calculated from the precision.
   
   ```
           let values: [u8; 20] = [0, 0, 0, 0, 0, 2, 17, 180, 219, 192, 255, 
255, 255, 255, 255, 253, 238, 75, 36, 64];
   
           let array_data = ArrayData::builder(DataType::Decimal(23, 6))
               .len(2)
               .add_buffer(Buffer::from(&values[..]))
               .build();
           let fixed_size_binary_array = DecimalArray::from(array_data);
   
           assert_eq!(
               8_887_000_000,
               fixed_size_binary_array.value(0)
           );
           assert_eq!(
               -8_887_000_000,
               fixed_size_binary_array.value(1)
           );
           assert_eq!(10, fixed_size_binary_array.value_length());
   ```


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to