[ 
https://issues.apache.org/jira/browse/KYLIN-1039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shaofeng SHI updated KYLIN-1039:
--------------------------------
    Labels: QE  (was: )

> 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
>              Labels: QE
>             Fix For: v2.0, v1.2
>
>         Attachments: KYLIN-1039-1.x-staging.patch
>
>
> 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)

Reply via email to