创建外部表时的相对路径错误

时间:2019-05-03 16:27:34

标签: hive beeline

我的任务是使用配置单元beeline创建一些外部表。但是我遇到了相对路径错误,说“绝对URI中的相对路径:hdfs:// localhost:8020./user/bigdata)(状态= 08S01,代码= 1) 正在中止命令集,因为“ force”为假并且命令失败:” 我正在使用hql脚本(按要求)创建外部表,我的脚本是这样的:

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';

然后,我在beeline服务器上执行此脚本,但是,遇到了上述错误。我已经在我的hadoop服务器上为ecustomer,eorder_detail,eproduct,esalesperson和eorder的每个表创建了一个文件夹。表格也上传到hadoop服务器。请帮助我解决错误。

1 个答案:

答案 0 :(得分:0)

尝试使用绝对路径,而不是相对路径。例如'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]