Parijat Chakraborty
Parijat Chakraborty

Reputation: 37

Using JSON Serde : java.net.URISyntaxException

I am new to Hive, Can anybody please help me with the below Error I receive when trying to create the following table:

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.** 

The error is:

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)**

My data takes the form:

JSON :

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

Thanks in advance.

Upvotes: 1

Views: 166

Answers (1)

Ben Watson
Ben Watson

Reputation: 5541

location should be an absolute path. If you really want your data to be in hdfs://localhost:9000/Mytable/employee, you should replace the last line with:

location '/Mytable/employee';

Upvotes: 1

Related Questions