hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Warren <>
Subject querying against union datatypes
Date Thu, 03 Jan 2013 19:29:44 GMT
Hello all -

I understand that support for union datatypes isn't complete, so I am
attempting to write a generic UDF to extract type-specific
information. For the example in the wiki

CREATE TABLE union_test(foo UNIONTYPE<int, double, array<string>,
SELECT foo FROM union_test;


the udf  would function as

SELECT union_extract(foo, 2) FROM union_test;


where the return value is of the type matching the union definition
(in this case, array<string>)

>From my understanding, the initialize function of a GenericUDF

     public ObjectInspector initialize(ObjectInspector[] arguments)

returns an ObjectInspector appropriate for the return value. Is it
possible to deduce from the arguments what type of ObjectInspector
should be returned?

Apologies if this is a basic question - I've written simple UDFs
before, butI  didn't find any similar examples in the Hive codebase.


View raw message