Hive列作为子查询选择

J.D*_*.D. 1 hive

我正试图用Hive做下面的事情.如何将Hive中的列定义为子查询?这可能在Hive中吗?

hive -e "           
select
distinct i.SearchListingID,
(select count(*) 
    from calls c 
    where c.ServiceID = i.SearchListingID
    ) as CallsCount
from Impressions i
where i.yyyymmdd = 20120401
limit 10" > ImpressionCalls.txt

Hive history file=/tmp/jd/hive_job_log_jd_201205222049_550931420.txt
Run Code Online (Sandbox Code Playgroud)

失败:解析错误:第4:1行无法识别"select"'count''附近的输入('在表达式规范中'

小智 9

Hive不支持相关的子查询.这样的事情呢?(我自己没有机会在Hive上验证这个查询)

select
    i.SearchListingID,
    count(*)
from
    (
    select
         distinct i.SearchListingID as SearchListingID 
    from 
        Impressions i
    where
        i.yyyymmdd = 20120401
    )i
    join
    calls c
    on(c.ServiceID = i.SearchListingID)
limit 10
Run Code Online (Sandbox Code Playgroud)