thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer" <jensge...@hotmail.com>
Subject Re: union support
Date Sat, 21 Sep 2013 13:45:34 GMT
Hi David,

I agree, and want to thank you for all the recherche work below.

> How come it's not documented anywhere ? It seems like a pretty
> major thing to be omitted.

As you found out, most of the documentation is in the (somewhat outdated) 
Wiki and the Jira tickets. Some more information can be found in the mailing 
archives, however that is a time-consuming and sometimes frustrating task. 
So yes, I agree that the documentation absolutely needs improvement.

https://issues.apache.org/jira/browse/THRIFT-409 should also be mentioned in 
that context. In general, unions have been introduced since 2009, there has 
been some improvement in the last months, contained in the 0.9.1 release.

> is http://wiki.apache.org/thrift/LibraryFeatures up to date?

No, terribly outdated. Some languages are not even listed there.

>  It's not mentioned in [...] the tutorial.thrift file

True. But it is mentioned in ThriftSpec.thrift and DebugProtoTest.thrift, 
altough both files are not on a prominent place in the source tree. 
Integrating it into the tutorials would only make sense, if all tutorial 
implementations get updated accordingly. I'm not so sure if that is a good 
idea.

>  It's not mentioned in the IDL docs (http://thrift.apache.org/docs/idl/),

Now it is.


And  of course, any patches are highly appreciated. ;-)

Best regards,
JensG



-----Urspr√ľngliche Nachricht----- 
From: David Rennalls
Sent: Friday, September 20, 2013 4:43 PM
To: user@thrift.apache.org
Subject: union support

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 


Mime
View raw message