neilconway opened a new issue, #10872:
URL: https://github.com/apache/arrow-rs/issues/10872

   ### Describe the bug
   
   `array_from_json` in arrow-integration-test decodes a Decimal256 `0` 
incorrectly.  It builds a little-endian two's-complement buffer for the value, 
which requires sign-extension fill bytes, but uses `0xFF` rather than `0x00` 
fill for a `0` input value.
   
   ### To Reproduce
   
   ```rust
   use arrow::array::AsArray;
   use arrow::datatypes::{DataType, Decimal256Type, Field};
   use arrow_integration_test::{array_from_json, ArrowJsonColumn};
   
   let field = Field::new("c", DataType::Decimal256(76, 0), false);
   let col: ArrowJsonColumn = serde_json::from_str(
       r#"{"name": "c", "count": 3, "VALIDITY": [1, 1, 1], "DATA": ["0", "1", 
"-1"]}"#,
   )
   .unwrap();
   let arr = array_from_json(&field, col, None).unwrap();
   let arr = arr.as_primitive::<Decimal256Type>();
   arr.value(0); // -256 — expected 0
   arr.value(1); // 1, correct
   arr.value(2); // -1, correct
   ```
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


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