You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Jamie Olson <ja...@gmail.com> on 2012/11/06 08:32:39 UTC

TRANSFORM + LATERAL VIEW?

Is it possible to select columns not in the TRANSFORM(...) operation?  I
did not see anywhere in the language definition for transform.  I'm looking
for something comparable to LATERAL VIEW for UDTF but with TRANSFORM
statements.

Ex: Not (seemingly?) legal:
FROM (
FROM xtab dat
id, TRANSFORM (x, y)
USING 'cat'
) map_out
INSERT INTO xresult SELECT map_out.*


Jamie Olson

Re: TRANSFORM + LATERAL VIEW?

Posted by Jamie Olson <ja...@gmail.com>.
Thanks.  I was just using cat as an example.  I'm actually running some R
scripts over TRANSFORM.  So I'll just have to manually JOIN the results
with the original table (or just append the new columns in the TRANSFORM
script).

Jamie Olson



On Wed, Nov 7, 2012 at 1:04 AM, Mark Grover <gr...@gmail.com>wrote:

> Jamie,
> Not that I know of.
>
> Assuming you will be using LATERAL VIEW for exploding the data, I can
> think of 2 options at the top of my head:
> 1. Pass 'id' column to your transform script. You will have to take care
> of the exploding data in your transform script. It would no longer be a
> simple 'cat'.
> 2. Return an array of entries from your Transform script. Consequently,
> use explode/lateral view on this array to achieve the desired result. The
> transform script will no longer be a cat, in this case too.
>
> Hope that helps. Let us know how it goes.
>
> Mark
>
> On Mon, Nov 5, 2012 at 11:32 PM, Jamie Olson <ja...@gmail.com>wrote:
>
>> Is it possible to select columns not in the TRANSFORM(...) operation?  I
>> did not see anywhere in the language definition for transform.  I'm looking
>> for something comparable to LATERAL VIEW for UDTF but with TRANSFORM
>> statements.
>>
>> Ex: Not (seemingly?) legal:
>> FROM (
>> FROM xtab dat
>> id, TRANSFORM (x, y)
>> USING 'cat'
>> ) map_out
>> INSERT INTO xresult SELECT map_out.*
>>
>>
>> Jamie Olson
>>
>>
>

Re: TRANSFORM + LATERAL VIEW?

Posted by Mark Grover <gr...@gmail.com>.
Jamie,
Not that I know of.

Assuming you will be using LATERAL VIEW for exploding the data, I can think
of 2 options at the top of my head:
1. Pass 'id' column to your transform script. You will have to take care of
the exploding data in your transform script. It would no longer be a simple
'cat'.
2. Return an array of entries from your Transform script. Consequently, use
explode/lateral view on this array to achieve the desired result. The
transform script will no longer be a cat, in this case too.

Hope that helps. Let us know how it goes.

Mark

On Mon, Nov 5, 2012 at 11:32 PM, Jamie Olson <ja...@gmail.com>wrote:

> Is it possible to select columns not in the TRANSFORM(...) operation?  I
> did not see anywhere in the language definition for transform.  I'm looking
> for something comparable to LATERAL VIEW for UDTF but with TRANSFORM
> statements.
>
> Ex: Not (seemingly?) legal:
> FROM (
> FROM xtab dat
> id, TRANSFORM (x, y)
> USING 'cat'
> ) map_out
> INSERT INTO xresult SELECT map_out.*
>
>
> Jamie Olson
>
>