Hive学习——Exception

Hive使用出现的问题1——分区表导入时 MetaException

Hive使用

  1. 建表语句:
create table t_user(id int, name string) partitioned by (country string) row format delimited fields terminated by ',';
  1. Load 数据加载语句
LOAD DATA local INPATH '/root/hivedata/5.txt' INTO TABLE t_user partition(country='USA');

进行分区数据加载出现如下错误:
在这里插入图片描述
3. 进入hive默认日志目录查看:vim /temp/root/hive.log

2020-08-15 13:13:31,024 ERROR [HiveServer2-Handler-Pool: Thread-30]: DataNucleus.Datastore (Log4JLogger.java:error(115)) - Error thrown executing ALTER TABLE `PARTITIONS` ADD COLUMN `TBL_ID` BIGINT NULL : Table 'hive.PARTITIONS' doesn't exist
java.sql.SQLSyntaxErrorException: Table 'hive.PARTITIONS' doesn't exist

4.解决方案:
(1)删除mysql中hive 数据库;
(2)hive的bin目录下schematool 命令初始化表:
./schematool -dbType mysql -initSchema

(3)重新在Hive中创建表 ,然后Load 加载数据
在这里插入图片描述

注意

本人使用的环境为hadoop2.0,hive2.6,jdk1.8,mysql8.0.20,mysql-connect-java.jar也是8.0.20
在配置hive-site.xml中配置时,驱动配置为com.mysql.cj.jdbc.Driver

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值