hive导入HDFS数据

在尝试使用Hive导入HDFS上的/qar_test.txt文件时遇到SemanticException,错误指出路径'hdfs://Master:9000/user/test/qar_test'无效。检查发现Hive元数据存储在MySQL数据库中,DBS表的DB_LOCATION_URI显示为'hdfs://10.1.51.200:9000/hive/warehouse'。修正导入命令,将路径改为'hdfs://10.1.51.200:9000/user/test/qar_test',问题得到解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

HDFS文件路径:/user/test/qar_test.txt

文件格式:***,***,***

创建hive表:

create table test_load(type STRING,num INT,time STRING)

partitioned by(name STRING)  //分区

row format delimited

fields terminated by ','  //以逗号分隔

stored as TEXTFILE

导入HDFS文件数据:

load data inpath 'hdfs://Master:9000/user/test/qar_test'

into table test_load

partition (name=‘MH');

报错:

FAILED: SemanticException Line 1:17 Invalid path ''hdfs://Master:9000/user/test/qar_test'': No files matching path hdfs://Master:9000/user/test/qar_test

路径不对,这个就很奇怪了。我再查询MySQL数据库(我的hive元数据放在MySQL数据库中,其它方法类似)。

查询hive下的DBS表DB_LOCATION_URI列:select DB_LOCATION_URI from DBS;

+----------------------------------------+
| DB_LOCATION_URI                        |
+----------------------------------------+
| hdfs://10.1.51.200:9000/hive/warehouse |

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值