发布于 2015-12-23 21:23:57
向jar授予正确的权限和所有权,然后运行ADD命令就可以了。我不知道为什么会这样!
发布于 2015-12-22 01:31:40
我能够在HDP 2.3沙箱上创建表。我明白问题所在。添加jar和list jar成功并不意味着jar对您是可用的。
遵循以下步骤:
Login to the terminal
cd to the path where your jar file is
ls -ltr hivexmlserde-1.0.5.3.jar
Launch hive cli and perform following
hive> add jar hivexmlserde-1.0.5.3.jar;
Added [hivexmlserde-1.0.5.3.jar] to class path
Added resources: [hivexmlserde-1.0.5.3.jar]
hive> CREATE TABLE xml_bank(customer_id STRING, income BIGINT, demographics map<string,string>, financial map<string,string>)
> ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
> WITH SERDEPROPERTIES (
> "column.xpath.customer_id"="/record/@customer_id",
> "column.xpath.income"="/record/income/text()",
> "column.xpath.demographics"="/record/demographics/*",
> "column.xpath.financial"="/record/financial/*"
> )
> STORED AS
> INPUTFORMAT 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
> OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
> TBLPROPERTIES (
> "xmlinput.start"="<record customer",
> "xmlinput.end"="</record>"
> );
OK
Time taken: 2.042 seconds
hive> select * from xml_bank;
OK
Time taken: 0.801 secondshttps://stackoverflow.com/questions/34406012
复制相似问题