1

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

提前致谢。

4

1 回答 1

0

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

location '/Mytable/employee';
于 2018-03-05T10:58:28.543 回答