【大数据开发】Hive错误

本文列举并解析了Hive在使用过程中常见的SQL错误及其解决办法,包括连接异常、语法错误、字段冲突等,并提供了针对性的解决方案。

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

持续更新ing

Hive错误

错误1:
org.apache.thrift.transport.TTransportException: java.net.SocketException: Connection reset by peer: socket write error
解决方式:
mysql数据库连接太久了,断开重连

错误2:
SemanticException [Error 10001]: Line 2:5 Table not found 'student'
解决方式:
语言异常:找不到表student
指定student是属于哪个数据库

错误3:
Error while compiling statement: FAILED: SemanticException Line 0:-1 Invalid column reference 'between': (possible column names are: sno, cno, degree)
解决方式:
编译时抛出语义异常:无效的列,后面列出来可能需要用的字段
意思是我现在的这个字段在该表中不存在,换一个括号里面的字段就好了

错误4:
Error while compiling statement: FAILED: SemanticException [Error 10025]: Line 8:7 Expression not in GROUP BY key 'c_id'
解决方式:
意思是字段c_id不在聚合函数的中
将select的所有关键字添加进聚合函数group by后面即可

错误5:
Error while compiling statement: FAILED: ParseException line 7:11 missing EOF at '(' near 'first_value'

解决方式:
EOF指的是缺了逗号,括号啊之类的,补上就好了

错误6:
SQL 错误 [40000] [42000]: Error while compiling statement: FAILED: NullPointerException null

解决方式:
空指针异常,first_value()里面忘了传参

错误7:
SQL 错误 [10035] [42000]: Error while compiling statement: FAILED: SemanticException [Error 10035]: Column repeated in partitioning columns

CREATE TABLE IF NOT EXISTS student(
sid string,
name string,
gender string,
age int, 
academy string, 
dt date,
chinese int,
math int,
english int 
)
PARTITIONED BY (academy string,dt date)
clustered BY (sid) sorted BY  (sid ASC) INTO 4 buckets
ROW format delimited
fields terminated BY '\t'
;

解决方式:
分区表中的字段不能和表中的字段重复

修改为
CREATE TABLE IF NOT EXISTS student(
sid string,
name string,
gender string,
age int, 
chinese int,
math int,
english int 
)
PARTITIONED BY (academy string,dt date)
clustered BY (sid) sorted BY  (sid ASC) INTO 4 buckets
ROW format delimited
fields terminated BY '\t'
;

错误8:
SQL 错误 [10096] [42000]: Error while compiling statement: FAILED: SemanticException [Error 10096]: Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict

解决方式:
set hive.exec.dynamic.partition.mode=nonstrict

错误9:
SQL 错误 [2] [08S01]: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

解决方式:
分区表加载数据时应该要指定字段,不能直接使用select * ,否则会报内存溢出

错误:

解决方式:









评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值