You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Russell Jurney <ru...@gmail.com> on 2012/09/26 22:54:48 UTC

Informal Code Review for ToJson(Tuple, Bag)

I'm wanting to get this into piggybank sometime, so I figure to post it
here before blogging about it tomorrow. If anyone had a minute for code
review, I'd appreciate it.

https://github.com/rjurney/pig-to-json/blob/master/src/com/hortonworks/pig/udf/ToJson.java

I needed this to store bags of tuples in Redis, because the
pig-redis<https://github.com/mattb/pig-redis>driver doesn't support
complex types. The one thing it doesn't do that
maybe it should is to be able to serialize fields into simple objects with
name/value, like:

B = foreach A generate ToJson(my_simple_field) -> {"my_simple_field": value}

At the moment that just returns: value

Also, is there an issue with the name? I could name it ToSimpleJson since
it isn't respecting Pig types beyond numeric/string types in javascript, if
we had a ToJson that produced a schema chunk a well.

-- 
Russell Jurney twitter.com/rjurney russell.jurney@gmail.com datasyndrome.com