【发布时间】:2017-08-24 10:23:27
【问题描述】:
我希望通过 .sql 脚本在 Hive 表中加载数据,但遇到这样的问题:
hduser@master:~$ hive -f script.sql
Logging initialized using configuration in jar:file:/home/hduser/ecosystem/apache-hive-2.3.0-bin/lib/hive-common-2.3.0.jar!/hive-log4j2.properties Async: true
OK
Time taken: 5.798 seconds
Loading data to table default.test
Failed with exception Unable to move source file:/home/hduser/Data.txt to destination hdfs://master:9000/user/hive/warehouse/test/Data.txt
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask. Unable to move source file:/home/hduser/Data.txt to destination hdfs://master:9000/user/hive/warehouse/test/Data.txt
我的脚本看起来像:
CREATE TABLE IF NOT EXISTS Test (
id int, mdp string, id_employe int, category int)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n' ;
LOAD DATA LOCAL INPATH '/home/hduser/Data.txt' OVERWRITE INTO TABLE Test ;
/home/hduser 中的权限是:
hduser@master:~$ ls -l
total 5364168
-rwx-wx-wx 1 hduser hduser 5492885458 août 24 11:38 Data.txt
-rw-rw-r-- 1 hduser hduser 684 août 24 12:14 derby.log
drwxrwxr-x 3 hduser hduser 4096 juil. 26 11:46 ecosystem
drwxrwxr-x 5 hduser hduser 4096 août 24 12:14 metastore_db
-rwx-wx-wx 1 hduser hduser 233 août 24 12:10 script.sql
数据看起来像:
1, jhkjhkjh, 18, 11
2, poilll, 87, 13
3, aoudliaoiud, 98, 76
...
在http://172.30.10.182:50070/explorer.html#/ 我有:
drwx-wx-wx hduser supergroup 0 B Aug 24 11:40 0 0 B tmp
then
drwx-wx-wx hduser supergroup 0 B Aug 24 11:40 0 0 B hive
then
drwx-wx-wx hduser supergroup 0 B Aug 24 12:14 0 0 B hduser
then
drwx-wx-wx hduser hduser 0 B Aug 24 12:12 0 0 B warehouse
then
drwx-wx-wx hduser hduser 0 B Aug 24 12:12 0 0 B test
你知道为什么我可以用 Data.txt 中的数据填充我的测试表吗?
【问题讨论】: