CurtHagenlocher opened a new pull request, #546:
URL: https://github.com/apache/arrow-dotnet/pull/546

   ### What's changed?
   
   Formatting a decimal as a string (`GetString`, and so `ToString` on the 
decimal arrays) and parsing one from a string sized their buffers by the type's 
precision and scale. On .NET Core the buffers were on the stack, so a type with 
a very large precision or scale could exhaust it.
   
   - The buffers are now sized by the digits the value can have. A value of a 
given byte width has at most 2.5 digits per byte, plus any zeros the scale adds.
   - Buffers of up to 256 chars stay on the stack; larger ones go on the heap. 
Sizes are computed so they can't overflow.
   - On .NET Framework the buffers were already on the heap, but were sized by 
the precision; they are now sized the same way.
   
   The precision is still used to reject values with too many digits, and 
results are unchanged.
   
   ### Testing
   
   New tests in `DecimalUtilityTests` format and parse values with a precision 
of up to `int.MaxValue` and a scale of 1,000,000, at byte widths 4, 8, 16 and 
32, and format the largest and smallest value of each width with a very large 
precision. All of `Apache.Arrow.Tests` passes on net8.0, net462 and net472.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_012dFdcrBz22tRjiyNwBd7VB
   


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