You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "mzz (Jira)" <ji...@apache.org> on 2020/09/08 11:25:00 UTC
[jira] [Commented] (KYLIN-3359) Support sum(expression) if possible
[ https://issues.apache.org/jira/browse/KYLIN-3359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17192148#comment-17192148 ]
mzz commented on KYLIN-3359:
----------------------------
Hi [~shaofengshi] [~yaho],
my version is 2.6.6, I create a model and use 'counts' col as a measure, when I run a query 'SELECT
DT,SUM(COUNTS) FROM VIW.VIW_QM_AGGS_LOG GROUP BY DT', The correct result is returned.
but ,when run a sum(expression) query...
*sql:*
{code:java}
SELECT
DT,
SUM(COUNTS),
SUM(case
when dt='20200901' then counts
else 0
end) AS S
FROM VIW.VIW_QM_AGGS_LOG
GROUP BY DT
HAVING DT='20200901'
{code}
*it report a error:
*
{code:java}
No realization found for OLAPContext, CUBE_NOT_READY, CUBE_UNMATCHED_AGGREGATION[FunctionDesc [expression=SUM, parameter=CASE(=($0, '20200901'), 1, 0), returnType=null]], rel#3453:OLAPTableScan.OLAP.[](table=[VIW, VIW_QM_AGGS_LOG],ctx=,fields=[0, 1, 2, 3, 4]) while executing SQL: "SELECT DT, SUM(COUNTS), SUM(case when dt='20200901' then 1 else 0 end) AS S FROM VIW.VIW_QM_AGGS_LOG GROUP BY DT HAVING DT='20200901' LIMIT 50000"
{code}
> Support sum(expression) if possible
> -----------------------------------
>
> Key: KYLIN-3359
> URL: https://issues.apache.org/jira/browse/KYLIN-3359
> Project: Kylin
> Issue Type: Sub-task
> Components: Query Engine
> Reporter: Zhong Yanghong
> Assignee: Zhong Yanghong
> Priority: Major
> Fix For: v2.4.0
>
> Attachments: KYLIN-3359-Hive-query.png, KYLIN-3359-Kylin-query.png
>
>
> The expression can be as follows:
> # a ~1~*col ~1~ + a ~2~*col ~2~ + ... + a ~n~*col ~n~ + b, if sum(col ~1~),sum(col ~2~),...sum(col ~n~) are defined
> # case when {{filter}} ~1~ then expr ~1~
> when {{filter}} ~2~ then expr ~2~
> ...
> else expr ~N~
> end, if {{filter}} ~1~,{{filter}} ~2~, ... {{filter}} ~N-1~, and expr ~1~,expr ~2~,...expr ~N~ are supported
> There's a constraint for the filter. That is it's able to push down the related filters in case when.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)