我是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"
}
}

提前致谢。

最佳答案

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

location '/Mytable/employee';

关于hadoop - 使用JSON Serde:java.net.URISyntaxException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49107950/

10-11 07:26