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

[jira] [Created] (KYLIN-1039) Wrong answer to query with filters including OR

Dayue Gao created KYLIN-1039:
--------------------------------

             Summary: Wrong answer to query with filters including OR
                 Key: KYLIN-1039
                 URL: https://issues.apache.org/jira/browse/KYLIN-1039
             Project: Kylin
          Issue Type: Bug
            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)