Process XML with HIVE



I am trying to create a view on top of an XML file in hive, but it just provides nulls for my 2 columns. Whats going wrong?



CREATE VIEW XMLView(ID,UserID) AS
SELECT
xpath_string (usersxml, 'USER[1]/ID'),
xpath_string (usersxml, 'USER[1]/USERID')
FROM users_xpath;


my table looks like this



CREATE EXTERNAL TABLE users_xpath (usersxml string)
STORED AS TEXTFILE
LOCATION 'mylib/users';


My XML file contains the following structure:



<USER>
<ID>129381jd</ID>
<USERID>123213jkhy6726131s</DEVICEID>
</USER>


Any inputs?


No comments:

Post a Comment