Reputation: 21
I want to extract particular column values from a hive table. That column has XML data. How to parse through XML data and extract name and values from that particular XML column. Also I want to insert the extracted data into another Hive table.
Upvotes: 1
Views: 1196
Reputation: 29175
Example :
select xpath ('<a><b id="1"><c/></b><b id="2"><c/></b></a>','/descendant::c/ancestor::b/@id') from t1 limit 1 ;
[1","2]
In both option you need to have Xpath expression knowledge.
If you want to insert extracted data in to another table then use create table as select xxx from xxxxx (Create Table As Select (CTAS))
Upvotes: 1