我可以在HDP 2.3沙箱上創建表格。我理解這個問題。添加jar和列表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 seconds
嗨杜爾加,我添加了屏幕截圖 – learninghuman
你可以嘗試在終端直接而不是通過瀏覽器? –
新增步驟,我明白問題所在。即使沒有註冊jar文件,添加jar和list jar也可以成功。 –