semanticexception[error 10085]:不支持带有横向视图的联接'id'

ruyhziif  于 2021-06-27  发布在  Hive
关注(0)|答案(2)|浏览(435)

我收到了上级发来的一个代码,当时他们正在处理旧的蜂群。我正在处理一个新的集群,并尝试在putty'bf mycode.sql'上使用直线函数运行它,抛出错误:
错误:编译语句时出错:失败:semanticexception[error 10085]:不支持第6:24行与横向视图的联接“id”(状态=42000,代码=10085)

create table myTable as select distinct AtypeId
,cast(from_unixtime(t.timestamp) as date) as date
,C
,t.id
,t.marketid
from File1 LATERAL VIEW explode(eventlist) exploded_table as t
join File2
on oldID=t.id
order by AtypeId,date;

你知道我该怎么做吗?

ylamdve6

ylamdve61#

如果有人面对这个问题,这对我来说很有效。

create table myTable as select distinct AtypeId
,cast(from_unixtime(t.timestamp) as date) as date
,t.id
,t.marketid
from File1 LATERAL VIEW explode(eventlist) exploded_table as t
order by AtypeId,date;

create table myTable2 as select distinct AtypeId
,date
,C
,id
,marketid
from myTable
inner join File2
on oldID=id;
kqlmhetl

kqlmhetl2#

按以下方式更改查询后重试:

create table myTable as
select t.* from
(
  select distinct 
     AtypeId
     ,cast(from_unixtime(t.timestamp) as date) as date
     ,C
     ,t.id
     ,t.marketid
  from 
     File1 LATERAL VIEW explode(eventlist) exploded_table
) as t join File2 on oldID=t.id
order by AtypeId,date;

对于不能同时使用连接和侧视图的ex,有一定的限制 lateral viewmap join .
我有一个疑问,在旧版本中,它可能在连接中做了一些不同的操作,所以没有抛出任何错误。你需要看看 explain plan 让两个版本都能更好地理解这一点。

相关问题