Hi,
I am working with Pig. How to parse XML with nested tags using UDF.I
tried with UDF and used List<Tuple> as the return type of the UDF while
compiling i get Unexpected data type java.util.ArrayList found in stream.
Note only standard Pig type is supported when you output from UDF/LoadFunc.
So I used bag as the return type , now I am having problem with retrieving
the fields using Pig .
My bag having the tuples where all the tuples having same
schema I don't know how to retrive those values.
XML:
<transaction><trans><trans_no>123</trans_no><pkid><pk1><no>10</no><name>nivetha</name></pk1><pk1><no>20</no><name>anu</name></pk1><pk1><no>30</no><name>anitha</name></pk1></pkid><description>Some
text</description></trans><trans><trans_no>124</trans_no><pkid><pk1><no>90</no><name>nivetha1</name></pk1><pk1><no>80</no><name>anu1</name></pk1><pk1><no>70</no><name>anitha1</name></pk1></pkid><description>Some
text</description></trans></transaction>
My UDF Output:
({(Some text,nivetha,10,123),(Some text,anu,20,123),(Some
text,anitha,30,123)})
({(Some text,nivetha1,90,124),(Some text,anu1,80,124),(Some
text,anitha1,70,124)})
regards,
Nivetha
I am working with Pig. How to parse XML with nested tags using UDF.I
tried with UDF and used List<Tuple> as the return type of the UDF while
compiling i get Unexpected data type java.util.ArrayList found in stream.
Note only standard Pig type is supported when you output from UDF/LoadFunc.
So I used bag as the return type , now I am having problem with retrieving
the fields using Pig .
My bag having the tuples where all the tuples having same
schema I don't know how to retrive those values.
XML:
<transaction><trans><trans_no>123</trans_no><pkid><pk1><no>10</no><name>nivetha</name></pk1><pk1><no>20</no><name>anu</name></pk1><pk1><no>30</no><name>anitha</name></pk1></pkid><description>Some
text</description></trans><trans><trans_no>124</trans_no><pkid><pk1><no>90</no><name>nivetha1</name></pk1><pk1><no>80</no><name>anu1</name></pk1><pk1><no>70</no><name>anitha1</name></pk1></pkid><description>Some
text</description></trans></transaction>
My UDF Output:
({(Some text,nivetha,10,123),(Some text,anu,20,123),(Some
text,anitha,30,123)})
({(Some text,nivetha1,90,124),(Some text,anu1,80,124),(Some
text,anitha1,70,124)})
regards,
Nivetha