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

Switch to Plain View
Pig >> mail # user >> Attaching column headers to the tuple

Copy link to this message
Attaching column headers to the tuple
I'm writing a pig script similar to:

A = load 'data' using org.apache.pig.piggybank.storage.XMLLoader('response') as (line:chararray);
B = foreach A GENERATE FLATTEN(Parser(line));
store B into my_data using PigStorage('\t');

This script basically reads a file which contains xml's dumped in it. The second line in a pig script calls the java udf which parses the xml.

The Parser UDF returns a data bag with multiple tuples
This outputs:

(1            91705    rondo music guitar)
(3            96629    award music guitar)

I'd like to add a header row to the output file:

(Id          Form     Query)
(1            91705    rondo music guitar)
(3            96629    award music guitar)

Any ideas?
=========This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
Cheolsoo Park 2013-06-09, 19:39