[ https://issues.apache.org/jira/browse/MESOS-3345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14726446#comment-14726446 ]
Joseph Wu edited comment on MESOS-3345 at 9/9/15 10:23 PM: ----------------------------------------------------------- I uploaded an experimental implementation which updates the PicoJSON library to version 1.3.0. By using their {{int64_t}} support, we don't need to break the Protobuf->JSON mapping. There are still some limitations. For example, you can't convert unsigned longs of greater than {{INT64_MAX}}, because of how PicoJSON does the conversion. *Update*: Unsigned ints greater than {{INT64_MAX}} lose some precision, but can still be converted. Reviews (split into 5, due to separate modifications to libprocess and stout): https://reviews.apache.org/r/38028/ https://reviews.apache.org/r/38030/ https://reviews.apache.org/r/38031/ https://reviews.apache.org/r/38076/ https://reviews.apache.org/r/38077/ was (Author: kaysoky): I uploaded an experimental implementation which updates the PicoJSON library to version 1.3.0. By using their {{int64_t}} support, we don't need to break the Protobuf->JSON mapping. There are still some limitations. For example, you can't convert unsigned longs of greater than {{INT64_MAX}}, because of how PicoJSON does the conversion. Reviews (split into 5, due to separate modifications to libprocess and stout): https://reviews.apache.org/r/38028/ https://reviews.apache.org/r/38030/ https://reviews.apache.org/r/38031/ https://reviews.apache.org/r/38076/ https://reviews.apache.org/r/38077/ > Expand the range of integer precision when converting into/out of json. > ----------------------------------------------------------------------- > > Key: MESOS-3345 > URL: https://issues.apache.org/jira/browse/MESOS-3345 > Project: Mesos > Issue Type: Task > Components: stout > Reporter: Joseph Wu > Assignee: Joseph Wu > Priority: Minor > Labels: json, mesosphere, protobuf > > For [MESOS-3299], we added some protobufs to represent time with integer > precision. However, this precision is not maintained through protobuf <-> > JSON conversion, because of how our JSON encoders/decoders convert numbers to > floating point. > To maintain precision, we can try one of the following: > * Try using a {{long double}} to represent a number. > * Add logic to stringify/parse numbers without loss when possible. > * Try representing {{int64_t}} as a string and parse it as such? > * Update PicoJson and add a compiler flag, i.e. {{-DPICOJSON_USE_INT64}} > In all cases, we'll need to make sure that: > * Integers are properly stringified without loss. > * The JSON decoder parses the integer without loss. > * We have some unit tests for big (close to {{INT32_MAX}}/{{INT64_MAX}}) and > small integers. -- This message was sent by Atlassian JIRA (v6.3.4#6332)