0
votes

My task is to create some external tables using hive beeline. But I encountered relative path error, says "Relative path in absolute URI: hdfs://localhost:8020./user/bigdata) (state=08S01,code=1) Aborting command set because "force" is false and command failed:" I am using a hql script(by requirement) to create external table, my script is this:

create external table ecustomer(
    customer_id     DECIMAL(3),
customer_code   VARCHAR(5),
company_name    VARCHAR(100),
contact_name    VARCHAR(50),    
contact_title   VARCHAR(30),
city        VARCHAR(30),
region      VARCHAR(2),
postal_code VARCHAR(30),
country     VARCHAR(30),
phone       VARCHAR(30),
fax     VARCHAR(30))
  row format delimited fields terminated by '|'
  stored as textfile location 'user/bigdata/ecustomer';

create external table eorder_detail(
order_id    DECIMAL(5),
product_id  DECIMAL(2),
customer_id DECIMAL(3),
salesperson_id  DECIMAL(1),
unit_price  DECIMAL(2,2),
quantity    DECIMAL(2),
discount    DECIMAL(1,1))
  row format delimited fields terminated by '|'
  stored as textfile location 'user/bigdata/eorder_detail';

create external table eproduct(
product_id  DECIMAL(2),
product_name    VARCHAR(50),
unit_price  DECIMAL(2,2),
unit_in_stock   DECIMAL(4),
unit_on_order   DECIMAL(3),
discontinued    VARCHAR(1))
 row format delimited fields terminated by '|'
 stored as textfile location 'user/bigdata/eproduct';

create external table esalesperson(
employee_id DECIMAL(1),
lastname    VARCHAR(30),
firstname   VARCHAR(30),
title       VARCHAR(50),
birthdate   VARCHAR(30),
hiredate    VARCHAR(30),
notes       VARCHAR(100))
 row format delimited fields terminated by '|'
 stored as textfile location 'user/bigdata/esalesperson';

create external table eorder(
order_id        DECIMAL(5),
order_date      VARCHAR(30),
ship_via        DECIMAL(1),
ship_city       VARCHAR(30),
ship_region     VARCHAR(30),
ship_postal_code    VARCHAR(30),
ship_country        VARCHAR(30))
 row format delimited fields terminated by '|'
 stored as textfile location 'user/bigdata/eorder';

then, I execute this script on beeline server, however, I encountered the abovementioned error. I have already create a folder on my hadoop server for each table which are ecustomer, eorder_detail, eproduct, esalesperson and eorder. And the tables are also uploaded to hadoop server. Please help me resolve the error.

1
hdfs://localhost:8020./user/bigdata This path has a . in it (after port number). Is this the cause? . translates to current directory which is definitely relative. - xenodevil

1 Answers

0
votes

Try using an absolute path, instead of a relative one. e.g. 'hdfs://localhost:8020/user/bigdata/ecustomer'

create external table ecustomer(
    customer_id     DECIMAL(3),
    customer_code   VARCHAR(5),
    company_name    VARCHAR(100),
    contact_name    VARCHAR(50),    
    contact_title   VARCHAR(30),
    city        VARCHAR(30),
    region      VARCHAR(2),
    postal_code VARCHAR(30),
    country     VARCHAR(30),
    phone       VARCHAR(30),
    fax     VARCHAR(30))
  row format delimited fields terminated by '|'
  stored as textfile location 'hdfs://localhost:8020/user/bigdata/ecustomer';

...

[same for other DDLs]