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

Switch to Threaded View
Pig, mail # user - ISOToUNix working in Pig 0.8.1 but not in Pig 0.11.0


Copy link to this message
-
Re: ISOToUNix working in Pig 0.8.1 but not in Pig 0.11.0
Ruslan Al-Fakikh 2013-09-20, 15:26
What was the error?

Not an issue, but why do you call the columns dt1, dt2, but not using the
name, using the ordinal number insted: $0?
On Fri, Sep 20, 2013 at 6:00 PM, Muni mahesh <[EMAIL PROTECTED]>wrote:

> Hi Hadoopers,
>
> I did the same thing in Pig 0.8.1 but not Pig 0.11.0
>
> register /usr/lib/pig/piggybank.jar;
> register /usr/lib/pig/lib/joda-time-2.1.jar;
>
> DEFINE CustomFormatToISO
> org.apache.pig.piggybank.evaluation.datetime.convert.CustomFormatToISO();
> DEFINE ISOToUnix
> org.apache.pig.piggybank.evaluation.datetime.convert.ISOToUnix();
>
> A = load '/home/user/Desktop/1.tsv' USING PigStorage('\t') AS
> (dt1:chararray, dt2:chararray);
> B = foreach A generate (long) ISOToUnix(CustomFormatToISO($0, 'yyyy-mm-dd
> hh:mm:ss'));
>
>
> *input *
> 2013-01-16 04:01:18    2013-01-16 04:01:36
> 2013-01-16 04:02:19    2013-01-16 04:03:11
>
> *output* *expected*
> (1358308878000,1358308896000)
> (1358308939000,1358308991000)
>