Hi, I only recently discovered Thrift's support for unions. It's not mentioned in the IDL docs (http://thrift.apache.org/docs/idl/), the tutorial .thrift file (https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift) nor the "missing guide" (http://diwakergupta.github.io/thrift-missing-guide/). I only stumbled onto it from this blog post http://nathanmarz.com/blog/thrift-graphs-strong-flexible-schemas-on-hadoop.html. Looks like Java support was added in 0.2 (with https://issues.apache.org/jira/browse/THRIFT-409) and Ruby support was added in 0.3 (with https://issues.apache.org/jira/browse/THRIFT-697). 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 http://thread.gmane.org/gmane.comp.lib.thrift.user/1696 where they referenced these blog posts (had to use web archive versions).. http://web.archive.org/web/20120114135816/http://blog.rapleaf.com/dev/2009/06/03/thrift-union-pattern/ http://web.archive.org/web/20100725051856/http://blog.rapleaf.com/dev/2009/08/18/thrift-unions-part-ii-or-how-i-reduced-memory-usage-by-95/ ...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 http://thread.gmane.org/gmane.comp.lib.thrift.user/1697 (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 https://issues.apache.org/jira/browse/THRIFT-1786, but is that in 0.9 or just trunk ? I saw some JIRAs mentioning C++ and unions as well. Is the 'Unions' column on http://wiki.apache.org/thrift/LibraryFeatures 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 https://issues.apache.org/jira/browse/THRIFT-680, 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.. Thanks, David
