kylin复杂查询

 
查询1:select sum(a.Reqnum),sum(a.shownum),sum(a.clicknum),sum(a.RtbActBidReq),sum(a.RtbWinBidReq) 
from
(
select
case when RequestMode=1 and ProcessNode>=2 then 1 else 0 end as Reqnum,
case when RequestMode=2 and IsEffective='1' then 1 else 0 end as shownum,
case when RequestMode=3 and IsEffective='1' then 1 else 0 end as clicknum,
case when ADPlatformProviderID>=100000 and IsEffective='1' and IsBilling='1' and IsBid=1 then 1 else 0 end as RtbActBidReq,
case when ADPlatformProviderID>=100000 and IsEffective='1' and IsBilling='1' and IsWin=1 then 1 else 0 end as RtbWinBidReq
from parquetlog
) a 
 
查询2:
select sum(if(RequestMode=1 and ProcessNode>=1,1,0)) from parquetlog
 
kylin能支持这两种查询么,所有的字段都设置了维度,或者说kylin有相关的支持函数说明么? 
 
 

李扬 - Apache Kylin committer & PMC member, Sr. Architect of eBay CCOE

赞同来自: fish 轩辕依梦Q 大饼辉

Kylin对Sum做预计算,所以Sum内部的函数必须在Cube构建之前计算。   处理的方法是定义一个新的字段Reqnum=if(RequestMode=1 and ProcessNode>=1,1,0),然后令Sum(Reqnum)为Cube Measure,查询时SQL也直接使用Sum(Reqnum)。用Hive View可以很容易添加这种新字段,Kylin使用Hive View为Fact表即可。

fish - Hadooper

赞同来自:

@李扬,听到Kylin好消息,恭喜恭喜啊!

要回复问题请先登录注册