thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khoi Nguyen Minh" <>
Subject RE: Problem with null value in Thrift map
Date Thu, 24 Jun 2010 16:51:09 GMT
I can set null for string, but can not set null for string value in map<string, string>,

I will try to wrap my value within a struct like your suggestion.

Thanks & best Regards,

-----Original Message-----
From: Łukasz Michalik [] 
Sent: Thursday, June 24, 2010 9:33 PM
Subject: Re: Problem with null value in Thrift map

On 06:33 2010-06-24 -0700, Bryan Duxbury wrote:
> Null is not directly supported by Thrift, though I think that some 
> libraries do their best to do *something*, which sounds like what 
> you're seeing. Maybe one of the PHP folks could remark as to what's happening?

As thrift claims to be multilingual, I can't possibly imagine how null would manage in C++.
 std::string can be "" and that's it, same with int (0) or double (0.0 -- well not completely,
as IEEE 754 allows stuff like NaN, but that's not really same thing).  There's no way to represent
distinction between null and "".

What you could do portably, it to wrap value that interests you in a struct with an extra
boolean field is_null and store that in map.

Łukasz P. Michalik

View raw message