You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "neilconway (via GitHub)" <gi...@apache.org> on 2026/08/26 16:59:44 UTC

[I] Displaying decimal values that exceed declared precision misbehaves [arrow-rs]

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

   ### Describe the bug
   
   As discussed in #2387, validating that a decimal value fits within the declared precision is opt-in; i.e., decimal values that exceed their type's declared precision is allowed. When such values are displayed/formatted (e.g., via `value_as_string`), there is incorrect behavior: either an incorrect value is produced or a panic occurs.
   
   ### To Reproduce
   
   ```rust
   use arrow_array::Decimal128Array;
   use arrow_schema::DataType;
   
   // 1234.5 declared as Decimal128(3, 1)
   let a = Decimal128Array::from(vec![12345])
       .with_precision_and_scale(3, 1)
       .unwrap();
   a.value_as_string(0); // "12.3" — expected "1234.5"
   
   // 12.345 declared as Decimal128(3, 3)
   let a = Decimal128Array::from(vec![12345])
       .with_precision_and_scale(3, 3)
       .unwrap();
   a.value_as_string(0); // ".123" — expected "12.345"
   
   // 1.2345 declared as Decimal128(2, 4)
   let a = Decimal128Array::from(vec![12345]).with_data_type(DataType::Decimal128(2, 4));
   a.value_as_string(0);
   ```
   
   ### Expected behavior
   
   The decimal value should be displayed correctly (i.e., the declared precision should effectively be ignored for display purposes).
   
   We could in principle produce an error instead of displaying such values, but this is difficult for practical purposes (e.g., related APIs don't return `Result` or a similar channel for surfacing errors), and would be inconsistent with Arrow behavior elsewhere.
   
   ### 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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Displaying decimal values that exceed declared precision misbehaves [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #10866: Displaying decimal values that exceed declared precision misbehaves
URL: https://github.com/apache/arrow-rs/issues/10866


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Displaying decimal values that exceed declared precision misbehaves [arrow-rs]

Posted by "neilconway (via GitHub)" <gi...@apache.org>.
neilconway commented on issue #10866:
URL: https://github.com/apache/arrow-rs/issues/10866#issuecomment-5428402092

   take


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org