使用JSON Serde:java.net.URISyntaxException

时间:2018-03-05 10:12:09

标签: hadoop hive hive-serde

我是Hive的新手,任何人都可以帮我解决下面在尝试创建下表时遇到的错误:

hive> create table Employees(
    > name String,
    > salary float,
    > subordinates array<string>,
    > deductions map<string,float>,
    > address struct<street:string,city:string,state:string>)
    > row format serde
    > 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe' << **this one is present in "hive-contrib"**
    > with serdeproperties ("field.delim"=",")
    > location 'Mytable/employee'; **<< This is in my HDFS location.** 

错误是:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: hdfs://localhost:9000./Mytable/employee)**

我的数据采用以下形式:

JSON :

{
"name":"Manager",
"salary":10000.0,
"subordinates": ["Emp1", "Emp2"],
"deductions":{
   "State Tax":0.1,
   "Insurance":2,   
},
"address":{
"street":"1 Ave",
"city":"Chicago",
"state":"IL"
}
}

提前致谢。

1 个答案:

答案 0 :(得分:0)

location应该是一条绝对的道路。如果您确实希望数据位于hdfs://localhost:9000/Mytable/employee,则应将最后一行替换为:

location '/Mytable/employee';