Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Replacing values


Copy link to this message
-
Replacing values
I have some tuples and I would like to be able to transform the first
row using the REGEX_EXTRACT method but leave all the other rows
untouched. Now I can easily do this with known and/or named fields but I
do not know the exact number of values in each tuple so something like
the following will not work:

foo = foreach views generate REGEX_EXTRACT($0, '.*\\b(\\d+)$', 1), $1,
$2, $3

I've tried the following but this duplicates the first value un-extracted:

foo = foreach views generate REGEX_EXTRACT($0, '.*\\b(\\d+)$', 1), *

Is there anyway I can accomplish modifying just the first value in each
tuple with an unknown number of values in each tuple?

Thanks