mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chun-Hung Hsiao <chhs...@mesosphere.io>
Subject Re: Review Request 59987: Added protobuf map support.
Date Fri, 29 Sep 2017 18:58:40 GMT


> On Sept. 22, 2017, 11:19 p.m., Chun-Hung Hsiao wrote:
> > 3rdparty/stout/include/stout/protobuf.hpp
> > Lines 433 (patched)
> > <https://reviews.apache.org/r/59987/diff/2/?file=1768786#file1768786line433>
> >
> >     The key can also be of an integral type.
> 
> Qian Zhang wrote:
>     Yeah, I had the same concern before. But in [our code](https://github.com/apache/mesos/blob/1.4.0/3rdparty/stout/include/stout/json.hpp#L190),
we define `JSON::Object::values` as a `string` to `JSON::Value` map, so I am not sure how
we can support non-string key.

I think that's because JSON cannos use a numeric value as a key. But we can do things like
the following in JSON:
```
{
  "1": 1.0,
  "2": 2.0
}
```
Given that ve already know the key type of the map from the reflection, we could parse the
string into the appropriate integral key type.


- Chun-Hung


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59987/#review186035
-----------------------------------------------------------


On July 4, 2017, 2:43 a.m., Qian Zhang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59987/
> -----------------------------------------------------------
> 
> (Updated July 4, 2017, 2:43 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Zhitao Li.
> 
> 
> Bugs: MESOS-7656
>     https://issues.apache.org/jira/browse/MESOS-7656
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Map is a feature of proto2 syntax, but it can only be compiled
> with proto3 compiler, see the following discussion for details:
> https://groups.google.com/forum/#!topic/protobuf/p4WxcplrlA4
> We have already upgraded the compiler from 2.6.1 to 3.3.0 in
> MESOS-7228, however, to use protobuf map in Mesos code, we also
> need to add the protobuf map support to the code in Mesos for
> converting protobuf message to JSON object and parsing JSON
> object as protobuf message, that is what I have done in this patch.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/protobuf.hpp 15690b66cc4ae0c1bf2c2176d73c385ca75d3c20

> 
> 
> Diff: https://reviews.apache.org/r/59987/diff/2/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Qian Zhang
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message