tustvold opened a new issue #1174:
URL: https://github.com/apache/arrow-rs/issues/1174


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   The `arbitrary_precision` feature flag added in 
https://github.com/apache/arrow-rs/pull/779 alters how serde_json decodes 
numeric types, decoding them as maps with special keys, instead of their native 
types.
   
   Unfortunately this has a tendency to break downstream code in strange ways - 
see 
[here](https://github.com/serde-rs/json/issues?q=is%3Aissue+is%3Aopen+arbitrary_precision).
 The nature of feature flags makes this both unexpected, hard to diagnose, and 
impossible to opt out of.
   
   **Describe the solution you'd like**
   
   I have filed a ticket for native 128-bit support in serde_json 
[here](https://github.com/serde-rs/json/issues/846) which I think is the ideal 
solution, but until then I would like to propose we encode 128-bit numbers as 
strings.
   
   FWIW I'm not sure this will necessarily be any more or less broken than the 
status quo, as whilst the official JSON specification states that numbers 
should be arbitrary precision, a number of implementations assume values fit 
into 64-bit doubles (i.e. 52-bits of integer precision). It is for this reason 
that protobuf's JSON format actually encodes 64-bit integers, let alone 128-bit 
integers as strings - see 
[here](https://developers.google.com/protocol-buffers/docs/proto3#json).
   
   **Describe alternatives you've considered**
   
   Add a feature flag to allow users to opt-in to using `arbitrary_precision`.
   


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