蜂巢列作为一个子查询选择(Hive column as a subquery select)

2019-06-24 17:01发布

我试图做类似下面蜂巢。 我怎样才能在蜂巢列被定义为一个子查询? 这是可能的蜂巢?

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

FAILED:解析错误:行4:1不能在表达规范识别邻近“选择”“计数”“(”输入

Answer 1:

相关子查询不蜂巢支持。 怎么样这样的事情呢? (我没有得到一个机会,在蜂巢验证此查询自己)

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


文章来源: Hive column as a subquery select
标签: hive