thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khoi Nguyen Minh" <kho...@dkt.com.vn>
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,
KhoiNM

-----Original Message-----
From: Łukasz Michalik [mailto:lmi@ift.uni.wroc.pl] 
Sent: Thursday, June 24, 2010 9:33 PM
To: thrift-user@incubator.apache.org
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.

--
Pozdrawiam,
Łukasz P. Michalik


Mime
View raw message