You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "liyang (JIRA)" <ji...@apache.org> on 2015/09/22 05:15:04 UTC

[jira] [Commented] (KYLIN-1039) Filter like (A or false) yields wrong result

    [ https://issues.apache.org/jira/browse/KYLIN-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14901848#comment-14901848 ] 

liyang commented on KYLIN-1039:
-------------------------------

I'm taking a look.

> Filter like (A or false) yields wrong result
> --------------------------------------------
>
>                 Key: KYLIN-1039
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1039
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: v1.0
>            Reporter: Dayue Gao
>
> The following query on test dataset produces a result set containing 5 rows.
> {code:sql}
> select test_cal_dt.week_beg_dt, sum(price) as GMV
>  from test_kylin_fact 
>  inner JOIN edw.test_cal_dt as test_cal_dt  ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt 
>  where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' and lstg_format_name='FP-GTC'
>  group by test_cal_dt.week_beg_dt
> {code}
> However, if I change the where condition to the following, Kylin produces empty result. This is wrong because `A or false` is just `A`, the result should be the same as above qeury.
> {code:sql}
>  where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01' and (lstg_format_name='FP-GTC' or 'a' = 'b')
> {code}
> I have tried to add a constant folding rule `ReduceExpressionsRule.FILTER_INSTANCE` from calcite, expecting planner to reduce the second query to the first one. But it didn't work. Seems the rule has bug in itself, see https://issues.apache.org/jira/browse/DRILL-2218.
> As as result, we need more investigating to see why it goes wrong and fix the problem.
> BTW, the second query may seems rediculous at first glance. But in fact this kind of query is generated by one of our reporting front-end.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)