配置单元表数据加载提供空值

mwecs4sa  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(345)

Select * from movierating 结果为空值。
我尝试了以下创建表查询:

CREATE TABLE movierating(id INT, movieid INT, rating INT, time string);
CREATE TABLE movierating(id INT, movieid INT, rating INT, time string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' stored as textfile;

尝试以下加载查询:

load data local inpath '/tmp/Movie-rating.txt' into table movierating;
load data local inpath '/tmp/Movie-rating.txt' OVERWRITE into table movierating;

“movie rating.txt”文件中的数据:(delimeter是tab)

1     123      3   881250949   
2     125      4   881250123
1yjd4xko

1yjd4xko1#

用于制表符分隔的数据 '\t' 作为字段分隔符:

CREATE TABLE movierating(id int,movieid int,rating int,time string) 
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY  '\t' LINES TERMINATED BY '\n' 
STORED AS TEXTFILE;

相关问题