蜂巢中不支持嵌套子查询

man*_*ula 5 hadoop

我们在蜂巢中尝试了以下查询。但得到错误。请以任何其他方式帮助我解决此问题。

select count(1) as OpenItems from issues i , issue_statuses s  

where s.id = i.status_id 

and  s.name NOT IN ('Closed','Passed','Rejected','On 

Hold','Baselined','Completed')

and i.project_id IN 

(select id from projects3 from

CASE WHEN ${projectname} = 'All' then id in

(select p.id from members m, projects3 p ,users_1 u

where m.project_id = p.id and u.id = m.user_id and u.status = '1'

and u.id IN 
(select u1.id from users_1 u1, Supervisor_hierarchy s1 where u1.mail = s1.email and s1.name = ${Superisorname})
group by p.id)
WHEN (${projectname} <>'All' and ${SubProject projectname} ='All') then id 
IN (select id from (select id from project_closure where parent_id in (select id from projects where name = ${projectname}) group by id)a)
WHEN (${SubProject projectname}<>'All' and ${projectname}<> 'All') then id 
IN (select id from(select id from project_closure where id in (select id from projects  where name = ${SubProject projectname}) group by id)a)
END
order by id)
Run Code Online (Sandbox Code Playgroud)

错误:6:5不支持的子查询表达式'id':子查询表达式同时引用了父查询和子查询表达式,并且不是有效的联接条件。

Mun*_*esh 1

我知道已经晚了,但为面临此问题的任何人发帖。

当我们遇到 Hive 子查询的以下一项或多项限制时,就会出现此问题。

在这种情况下,对父查询的引用在 Group By 子句中使用,这属于第四个限制。

Hive 子查询限制

  1. 这些子查询仅在表达式的右侧受支持。
  2. IN/NOT IN 子查询只能选择单个列。
  3. EXISTS/NOT EXISTS 必须具有一个或多个相关谓词。
  4. 仅在子查询的 WHERE 子句中支持对父查询的引用。

来源: https ://cwiki.apache.org/confluence/display/Hive/LanguageManual+SubQueries