MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_decimal_array

Function test_decimal_array

arrow-array/src/array/primitive_array.rs:2437–2452  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2435
2436 #[test]
2437 fn test_decimal_array() {
2438 // let val_8887: [u8; 16] = [192, 219, 180, 17, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
2439 // let val_neg_8887: [u8; 16] = [64, 36, 75, 238, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255];
2440 let values: [u8; 32] = [
2441 192, 219, 180, 17, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 36, 75, 238, 253, 255, 255,
2442 255, 255, 255, 255, 255, 255, 255, 255, 255,
2443 ];
2444 let array_data = ArrayData::builder(DataType::Decimal128(38, 6))
2445 .len(2)
2446 .add_buffer(Buffer::from(&values))
2447 .build()
2448 .unwrap();
2449 let decimal_array = Decimal128Array::from(array_data);
2450 assert_eq!(8_887_000_000_i128, decimal_array.value(0));
2451 assert_eq!(-8_887_000_000_i128, decimal_array.value(1));
2452 }
2453
2454 #[test]
2455 fn test_decimal_append_error_value() {

Callers

nothing calls this directly

Calls 3

add_bufferMethod · 0.80
buildMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected