You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Sharma, Akash" <Ak...@searshc.com> on 2011/05/03 21:51:39 UTC

Question about Pig UDF and sqoop export

New to Pig UDF so requesting help to resolve the issue

Created a Pig UDF to transform an input tuple and generate an
transformed tuple. 
Executed a Store to save the transformed tuple into a file

B = FOREACH A GENERATE PackageName.MyMethod();
STORE B into 'output' USING PigStorage();

My question is that when sqoop export reads this data from output HDFS
file and inserts into MYSQL table, the curly braces "(" and ")" are also
saved into the first and the last column of mysql table. Is there a way
to avoid curly braces for getting into MySQL column as part of first and
last column?

I tried to delimit to tabs explicitly in PigStorage() but that did not
resolve the issue.


Any help is appreciated.

Thanks
-Akash

RE: Question about Pig UDF and sqoop export

Posted by "Sharma, Akash" <Ak...@searshc.com>.
Finally figured it out. 

Flatten did the trick. Had to call flatten on the tuple returned by the
UDF as shown below.

B = FOREACH A GENERATE FLATTEN(PackageName.MyMethod());

Hope someone out there can make use of this behavior.

Thanks
-Akash

-----Original Message-----
From: Sharma, Akash [mailto:Akash.Sharma@searshc.com] 
Sent: Tuesday, May 03, 2011 2:52 PM
To: user@hive.apache.org
Subject: Question about Pig UDF and sqoop export

New to Pig UDF so requesting help to resolve the issue

Created a Pig UDF to transform an input tuple and generate an
transformed tuple. 
Executed a Store to save the transformed tuple into a file

B = FOREACH A GENERATE PackageName.MyMethod();
STORE B into 'output' USING PigStorage();

My question is that when sqoop export reads this data from output HDFS
file and inserts into MYSQL table, the curly braces "(" and ")" are also
saved into the first and the last column of mysql table. Is there a way
to avoid curly braces for getting into MySQL column as part of first and
last column?

I tried to delimit to tabs explicitly in PigStorage() but that did not
resolve the issue.


Any help is appreciated.

Thanks
-Akash