Support Questions
Find answers, ask questions, and share your expertise

Apache PIG - When insert STORE function it gives me error

Explorer

I've the following code:

Source = LOAD '.../MyTextFiles' using PigStorage(' '); 
Data = FOREACH Source GENERATE (chararray)$1 AS Detail_ID, (chararray)$2 AS Code_Time, (chararray)$3 AS BreakLine;
Transform = FOREACH Data GENERATE $1, ToUnixTime($2,'dd/MM/yyyyHH:mm:ss','GMT'), $3;
SPLIT Transform INTO Src31 IF ToDate($2,'yyyy-MM-dd')==ToDate('2013-12-31', 'yyyy-MM-dd'), 
Src01 IF ToDate($2,'yyyy-MM-dd')==ToDate('2014-01-01', 'yyyy-MM-dd'); 
STORE Src31 INTO '.../31_06_2016' using PigStorage(' '); 
STORE Src01 INTO '.../01_07_2016' using PigStorage(' ');

If run the code without the STORE Statement it fives me successfully but If I try to introduce the new data into a new tables it gives me error... anyone knows why?

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Apache PIG - When insert STORE function it gives me error

Expert Contributor
8 REPLIES 8

Re: Apache PIG - When insert STORE function it gives me error

Maybe a small sample dataset would help so someone could try to run it as maybe the gotcha is not with the STORE, but the presence of it means all the transformations have to run. If it is a problem prior to the STORE, then the error (whatever it is since we don't have the output of that) should surface just the same if you used DUMP to display the data.

If DUMP (and not STORE) is working, then probably just a permissions issue with the location you are storing. Again, supply a small sample dataset and I'm sure somebody will chew on it for a few minutes to see if they can figure it out.

Re: Apache PIG - When insert STORE function it gives me error

Explorer

Here's my source code :) Many thanks Lester! src-data.txt

Re: Apache PIG - When insert STORE function it gives me error

Explorer

src-data.txt Here's my source code :) Many thanks Lester!

Re: Apache PIG - When insert STORE function it gives me error

Can you please share the exact error message ??

Re: Apache PIG - When insert STORE function it gives me error

Explorer

Hi Suyog, I already found the problem. I can't tranform millseconds into Unix TimeStamp... I'm trying to convert this field...

Re: Apache PIG - When insert STORE function it gives me error

Good to go then, @Johnny Fugers? No further help needed, right?

Re: Apache PIG - When insert STORE function it gives me error

Explorer

Right Lester :) Thanks!

Re: Apache PIG - When insert STORE function it gives me error

Expert Contributor