【报错】Hive:cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector

Hive使用过程遇到报错:

Caused by: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector cannot be cast to org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector
	at org.apache.hadoop.hive.ql.exec.JoinUtil.isFiltered(JoinUtil.java:241)
	at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.createForwardJoinObject(CommonJoinOperator.java:504)
	at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genObject(CommonJoinOperator.java:647)
	at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.genJoinObject(CommonJoinOperator.java:538)
	at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.checkAndGenObject(CommonJoinOperator.java:940)
	at org.apache.hadoop.hive.ql.exec.JoinOperator.endGroup(JoinOperator.java:264)
	at org.apache.hadoop.hive.ql.exec.spark.SparkReduceRecordHandler.close(SparkReduceRecordHandler.java:442)
	... 12 more

解决:

排查后发现JOIN ON后面跟的多个条件链接字符是‘,’,改成‘and’即可。

类似这样:

select
    id
    ,name
from table1
left join
select
    id
    ,name
from table2
on (table1.id=table2.id and table1.name=table2.name)

 

你可能感兴趣的:(报错解决方案)