[
https://issues.apache.org/jira/browse/MESOS-3345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14724332#comment-14724332
]
Joseph Wu commented on MESOS-3345:
----------------------------------
I don't think this will quite work. (And aren't we using protobufs version 2?)
>From what I can tell, if there's a {{"}} in the JSON, our PicoJson parser will
>return it as a string. If there's a digit (0-9), PicoJson will parse it as a
>double. Some things might break if we start printing JSON ints as strings.
Perhaps we could update PicoJson:
https://github.com/kazuho/picojson#experimental-support-for-int64_t
And then use the experimental int64_t.
> 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:
> 1) Try using a {{long double}} to represent a number.
> 2) Add logic to stringify/parse numbers without loss when possible.
> 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)