Select * from movierating
给出NULL值作为结果。
我在下面尝试过创建表查询:
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”文件:(用分号显示)
1 123 3 881250949
2 125 4 881250123
答案 0 :(得分:1)
对于制表符分隔的数据,请使用'\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;