We have 2 example serdes, one for text data (regexserde), one for binary data (thriftserde).
But the simplest solution for this is to add a udf get_json_objects that returns a bunch of fields in an array. Then we can use sub query to extract the array elements as individual elements, until we have support for common expression extraction. There are a few example udf in the ctrib package illustrating the way to accept variable number of arguments. Let us know how it goes. Zheng On 10/2/09, Bobby Rullo <[email protected]> wrote: > Hi there, > > I want to create a new JSON Field/Column type. I know there exists > get_json_object(), but the things is I want to multiple JSON > operations in a single select statement and don't want to incur the > cost of parsing the JSON over and over again, because our json > structures are quite large. > > Our schema is two fields - the first is a string of some sort used as > an id, and the second is a huge JSON structure. I want to be able > write sql like the following: > > select Foo(json), Bar(json), Baz(json) where Quux(json) like '%hello%'; > > Foo(), Bar(), Baz() and Quux() are all UDF's that operate on json. > Right now what I'm doing is storing the JSON as a string and in each > of those UDF's I am de-serializing the json, and returning another > string. > > Ideally I'd want to be able to return JSON objects from these UDF's so > I could compose my functions like "Foo(Bar(Baz(json))" > > I'm thinking I need to create a SerDe but SerDe's seem to work at the > table level, not at the field level (in other words, I just need a > custom field, not a entire custom table type...or do I!?) > > Also, if there's any docs on writing custom SerDe's please let me > know...I haven't been able to find much. > > Thanks! > > Bobby > -- Sent from Gmail for mobile | mobile.google.com Yours, Zheng
