You need to pass two chararray instead of the tuple: tooutput = FOREACH A GENERATE org.apache.pig.piggybank.evaluation.datetime.DiffDate(t1.t1a, t1.t1b) AS diffrerence:int;
Daniel On Thu, Aug 18, 2011 at 9:05 PM, ipshita chatterji <[email protected]> wrote: > Hi Folks, > > I am very new to PIG. I am facing problems in using DiffDate function > present in org.apache.pig.piggybank. > evaluation.datetime. > > How do I pass 2 dates in a tuple format? > > I get an error. > > This is what I do: > > A= LOAD 'date.csv' AS (t1:tuple(t1a:chararray, t1b:chararray)); > > DESCRIBE A; > DUMP A; > tooutput = FOREACH A GENERATE > org.apache.pig.piggybank.evaluation.datetime.DiffDate(t1) AS > diffrerence:int; > describe tooutput; > > The date.csv has 1 line as follows: > ("20110920","20110918") > > The error message: > > 2011-08-18 03:41:10,922 [main] ERROR org.apache.pig.tools.grunt.Grunt - > ERROR 1045: Could not infer the matching function for > org.apache.pig.piggybank.evaluation.datetime.DiffDate as multiple or none of > them fit. Please use an explicit cast. > > What am I doing wrong in the code snippet above? > The pig version which I use is 0.8.0-CDH3B4 > Thanks a lot, > Rekha >
