|
|
-
TRANSFORM + LATERAL VIEW?
Jamie Olson 2012-11-06, 07:32
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?
Mark Grover 2012-11-07, 06:04
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 <[EMAIL PROTECTED]>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?
Jamie Olson 2012-11-07, 17:41
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 <[EMAIL PROTECTED]>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 <[EMAIL PROTECTED]>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 >> >> >
|
|