Hive 配置单元中的XML数据加载

Hive 配置单元中的XML数据加载,hive,Hive,我有一个xml文件,比如 <document> <site> <url>htp://www.abc.com/</url> <category>Sports</category> <usercount>120</usercount> <review>good site</review> </site> <site> <url>http

我有一个xml文件,比如

<document>
<site>  
<url>htp://www.abc.com/</url>
<category>Sports</category>
<usercount>120</usercount>  
<review>good site</review>
</site> 
<site>
<url>http://www.fb.com/</url>
<category>Social</category>
<usercount>100</usercount>  
<review>Addictive</review>
</site> 
<site>  
<url>http://www.google.com/</url>
<category>Web Search</category>
<usercount>1000</usercount>  
<review>helpful</review>
</site> 
</document>

htp://www.abc.com/
体育
120
好地点
http://www.fb.com/
社会的
100
上瘾的
http://www.google.com/
网络搜索
1000
有益的
我正在创建下面的脚本表

    create table IF NOT EXISTS xmltest(url STRING,category STRING,usercount STRING,review STRING)
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.url"="/document/site/url/text()",
"column.xpath.category"="/document/site/category/text()",
"column.xpath.usercount"="/document/site/usercount/text()",
"column.xpath.review"="/document/site/review/text()")
STORED AS
INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
TBLPROPERTIES (
"xmlinput.start"="<document",
"xmlinput.end"="</document>");
create table IF NOT EXISTS xmltest(url字符串、category字符串、usercount字符串、review字符串)
行格式SERDE'com.ibm.spss.hive.serde2.xml.XmlSerDe'
具有serdeproperty(
“column.xpath.url”=“/document/site/url/text()”,
“column.xpath.category”=“/document/site/category/text()”,
“column.xpath.usercount”=“/document/site/usercount/text()”,
“column.xpath.review”=“/document/site/review/text()”)
存储为
INPUTFORMAT'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
OUTPUTFORMAT'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
TBLProperty(

“xmlinput.start”=“您必须再创建一个表,然后向其中插入数据。正如一次性使用SERDE一样,您无法使用它来加载数据或创建自己的SERDEHi Sandeep,感谢您的提示。是否有apache提供的SERDE用于创建表,而不是编写我们自己的SERDE?
'<string>htp://www.abc.com/http://www.fb.com/http://www.google.com/</string>    <string>SportsSocialWeb Search</string> <string>1201BillionSeveral Billions</string>    <string>good siteAddictiveVery helpful</string>'