I developed the inline udtf. Seems to work:
http://svn.apache.org/repos/asf/hive/trunk/ql/src/test/queries/clientpositive/udf_inline.q
as (id, text) FROM SRC limit 2;
SELECT inline(
ARRAY(
STRUCT (1,'dude!'),
STRUCT (2,'Wheres'),
STRUCT (3,'my car?')
)
) as (id, text) FROM SR
Figured it out
fromhttps://cwiki.apache.org/Hive/languagemanual-udf.html#LanguageManualUDF-ComplexTypeConstructors
It should beINSERT INTO TABLE oc SELECT named_struct('a', x, 'b', y) FROM tc;
--- On Wed, 2/13/13, Dean Wampler wrote:
From: Dean Wampler
Subject: Re: IN
Hmm. I tried the following hacks, but all wouldn't parse. Ideas?
I changed:
... select struct(x,y) ...
to
... select struct(x,y) as struct ...
... select cast(struct(x,y) as struct) ...
... select struct(x as a,y as b) ...
Okay, but there is a hack that does work; By pass INSERT INTO a