You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Turner Kunkel <th...@gmail.com> on 2009/07/29 21:52:40 UTC
Relative element referencing?
Hi,
I have uneven amounts of elements in tuples in my relation.
I know you can reference elements by index by $0, $1, etc., but is there a
way to relatively reference them? As in a "get third from last element" or
$last-1?
I want my script to look like this:
B = FOREACH A GENERATE $0,$1,$2,$3,[third from last],[second from
last],[last]
If you get my drift, so I can use the GROUP function to count up some
numbers.
Thanks!
--
-Turner Kunkel
RE: Relative element referencing?
Posted by Olga Natkovich <ol...@yahoo-inc.com>.
There is no way to do that. The model is that you refer to columns by
position or name and if data for a particular column is missing, a null
is injected.
Olga
-----Original Message-----
From: Turner Kunkel [mailto:thkunkel@gmail.com]
Sent: Wednesday, July 29, 2009 12:53 PM
To: pig-user@hadoop.apache.org
Subject: Relative element referencing?
Hi,
I have uneven amounts of elements in tuples in my relation.
I know you can reference elements by index by $0, $1, etc., but is there
a
way to relatively reference them? As in a "get third from last element"
or
$last-1?
I want my script to look like this:
B = FOREACH A GENERATE $0,$1,$2,$3,[third from last],[second from
last],[last]
If you get my drift, so I can use the GROUP function to count up some
numbers.
Thanks!
--
-Turner Kunkel