[ https://issues.apache.org/jira/browse/KYLIN-5400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiale He updated KYLIN-5400: ---------------------------- Attachment: image-2023-01-11-10-13-27-688.png > The query statement contains count(distinct), and an error is reported that > distinct aggregation not supported > -------------------------------------------------------------------------------------------------------------- > > Key: KYLIN-5400 > URL: https://issues.apache.org/jira/browse/KYLIN-5400 > Project: Kylin > Issue Type: Bug > Components: Query Engine > Affects Versions: 5.0-alpha > Reporter: Jiale He > Assignee: Jiale He > Priority: Major > Fix For: 5.0-alpha > > Attachments: image-2023-01-11-10-11-47-227.png, > image-2023-01-11-10-12-17-625.png, image-2023-01-11-10-13-13-657.png, > image-2023-01-11-10-13-27-688.png, image-2023-01-11-10-13-43-324.png > > > > 参考如下SQL,where中的两个and条件互斥。 > {code:java} > select count(distinct STR0) > from TDVT.CALCS > WHERE (CALCS."STR0" = '0330FH') > AND (CALCS."STR0" = '0798FH'){code} > h1. Root Cause > where条件为 = 时,查询一定是互斥的,生成relnode之后会被解析为常量查询,走calcite,calcite这里有bug,不支持distinct > aggregation然后报错。 > !image-2023-01-11-10-11-47-227.png|width=644,height=172! > > h1. Fix Design > 修复Calcite的问题,难度比较大,时间跨度也会比较长。 > 快速的修复方案,可以通过修改是否路由到calcite的判断条件(org.apache.kylin.query.engine.QueryExec#isCalciteEngineCapable),当AggregateRel的input是values并且aggCall是distinct的时候,使该常量查询路由到spark,绕过calcite的问题。 > !image-2023-01-11-10-12-17-625.png|width=819,height=100! > -- This message was sent by Atlassian Jira (v8.20.10#820010)