kylin2.0无法使用sum(case...when)

如下语句,使用sum(case...when)时报错(sql如图所示),具体错误如下:
Error while executing SQL "SELECT tw.brand_id, tw.trans_date AS report_date, sum(CASE WHEN tw.trans_code='1002' THEN tw.amount ELSE 0 END) AS integral_consume_new_member FROM bi.trans_water AS tw WHERE tw.trans_date >= '2016-01-01' AND tw.trans_date < '2016-02-01' AND tw.trans_code IN ('0002','1002','1006','2002','2006','3001') GROUP BY tw.brand_id, tw.trans_date LIMIT 50000": Can't find any realization. Please confirm with providers. SQL digest: fact table BI.TRANS_WATER,group by [BI.TRANS_WATER.BRAND_ID, BI.TRANS_WATER.TRANS_DATE],filter on [BI.TRANS_WATER.TRANS_CODE, BI.TRANS_WATER.TRANS_DATE],with aggregates[FunctionDesc [expression=SUM, parameter=CASE(=($1, '1002'), $2, 0), returnType=null]].
 
sum_case_when.png

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

赞同来自: fish

要回复问题请先登录注册