Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Apache PIG - When insert STORE function it gives me error

avatar
Contributor

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

avatar
Super Collaborator
8 REPLIES 8

avatar

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.

avatar
Contributor

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

avatar
Contributor

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

avatar

Can you please share the exact error message ??

avatar
Contributor

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

avatar

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

avatar
Contributor

Right Lester 🙂 Thanks!

avatar
Super Collaborator

Hi @Johnny Fugers and @Suyog Nagaokar,

I tried to provide the answer here . Please let me know if you still have issues.

https://community.hortonworks.com/questions/46444/convert-millseconds-into-unix-timestamp.html#answe...

Thanks,

Sujitha