gpt4 book ai didi

hadoop - 使用 Hadoop 将数据加载到 Hive 表中

转载 作者:可可西里 更新时间:2023-11-01 16:38:50 24 4
gpt4 key购买 nike

我想通过 .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 中的数据填充我的测试表吗?

最佳答案

要写入文件的目录是

/user/hive/warehouse/test/

您通过浏览器查看的权限是为了

/tmp/hive/warehouse/test/

所以这是一个明显的不匹配。

关于hadoop - 使用 Hadoop 将数据加载到 Hive 表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45859116/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com