You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Vivek Goel <go...@gmail.com> on 2013/07/22 17:23:02 UTC
Returning Null in thrift server
Hi,
Is there a way to return null in thrift server ?
I have a string data type , Which can have three possible values:
1. Empty String
2. Null String
3. Some string value
I want to differentiate b/w Empty String and Null String.
Currently I have done like:
MyDataType{
string value;
bool is_null;
}
I set's is_null as true if value is null. Is there any better way of doing
this ?
regards
Vivek Goel
Re: Returning Null in thrift server
Posted by Randy Abernethy <Ra...@rx-m.com>.
Hello Vivek,
You might try making it optional. Then you could have three states:
not set,
set to ""
set to "hello Thrift"
Best,
Randy
On 7/22/2013 8:23 AM, Vivek Goel wrote:
> Hi,
>
> Is there a way to return null in thrift server ?
>
> I have a string data type , Which can have three possible values:
>
> 1. Empty String
> 2. Null String
> 3. Some string value
>
> I want to differentiate b/w Empty String and Null String.
>
> Currently I have done like:
>
> MyDataType{
>
> string value;
>
> bool is_null;
>
> }
>
> I set's is_null as true if value is null. Is there any better way of doing
> this ?
> regards
> Vivek Goel
>
--
Randy Abernethy
Managing Partner, RX-M, LLC
randy.abernethy@rx-m.com
Cell: +1-415-624-6447
San Francisco: +1-415-800-2922
Tokyo: +81-50-5532-8040
www.rx-m.com
@rxmllc
Re: Returning Null in thrift server
Posted by Dan Kuebrich <da...@gmail.com>.
You could use a union to get closer, but it's highly similar to what you
already proposed. See: https://issues.apache.org/jira/browse/THRIFT-409
On Mon, Jul 22, 2013 at 11:23 AM, Vivek Goel <go...@gmail.com>wrote:
> Hi,
>
> Is there a way to return null in thrift server ?
>
> I have a string data type , Which can have three possible values:
>
> 1. Empty String
> 2. Null String
> 3. Some string value
>
> I want to differentiate b/w Empty String and Null String.
>
> Currently I have done like:
>
> MyDataType{
>
> string value;
>
> bool is_null;
>
> }
>
> I set's is_null as true if value is null. Is there any better way of doing
> this ?
> regards
> Vivek Goel
>