thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rennalls <>
Subject union support
Date Fri, 20 Sep 2013 14:43:17 GMT
   I only recently discovered Thrift's support for unions. It's not
mentioned in the IDL docs (, the
tutorial .thrift file
nor the "missing guide"
( I only stumbled
onto it from this blog post
Looks like Java support was added in 0.2 (with and Ruby support was
added in 0.3 (with
How come it's not documented anywhere ? It seems like a pretty major
thing to be omitted.

Someone had the same question on the mailing list a while back where they
referenced these blog posts (had to use web archive versions)..
...the rapleaf blog author was originally using the "workaround" of
having a struct with all optional fields and then ended up raising a
JIRA to get union support added etc... We're using that "workaround"
where I work right now, but looks like it would be good to transition
to unions as that was the desired behavior in the first place.

According to
(April 2011)...
"...There is full-fledged support for Unions in the IDL and the Java
and Ruby libraries. Other languages will just generate a struct with
the same set of fields, so they are backwards compatible...."

I also found this for C# support, but is that in 0.9
or just trunk ? I saw some JIRAs mentioning C++ and unions as well. Is
the 'Unions' column on
up-to-date ? We have a Java server with clients in Java, Perl and
Python and we're using 0.9.0, so I guess transitioning to using unions
would only benefit Java code (and IDL readability) in our case. While
typing this I noticed there's already a JIRA for updating the docs, so I won't raise
another one. However, until more detailed docs can be added (I know it
takes time) could someone at least add it to the IDL page so new users
know about it. If users are at least made aware of it they can do more
digging on it's usage, supported languages etc..


View raw message