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

ASF subversion and git services commented on KYLIN-5839:
--------------------------------------------------------

Commit be22ca0de7e512df5dc443b99ed6df63635f9dfe in kylin's branch 
refs/heads/kylin5 from Pengfei Zhan
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=be22ca0de7 ]

KYLIN-5839 Block agg-push-down for non-equal-join

KYLIN-5382 only deals with the equal-join conditions and gives the
corresponding test cases.
KYLIN-5831 fixed the problem where non-equiv-join conditions were
incorrectly converted to equivalent conditions. Due to the lack of test
cases, a regression bug occurs in ContextUtil.isJoinFromSameContext.

The related non-equiv-join sql is as follows.
If you want a corresponding equal-join sql, just remove the condition
content `or (t2.fcol_10 is null and t5.fcol_17 is null)`.

```sql
select t2.fcol_7 fcol_7, count(distinct t2.fcol_6) fcol_6
from (select t1.company_code fcol_6, t1.type_name fcol_7,
          case when t1.created_date = t0.fcol_1 then 'TRUE'
          else 'FALSE' end fcol_10
      from ( select company_code, created_date, type_name
            from "DEFAULT"."TEST_AGG_PUSH_DOWN" ) t1
            join ( select company_code, max(created_date) fcol_1
                   from "DEFAULT"."TEST_AGG_PUSH_DOWN"
                   group by company_code
            ) t0 on t1.company_code = t0.company_code
    ) t2 join ( select 'TRUE' fcol_17 ) t5
    on  t2.fcol_10 = t5.fcol_17 or (t2.fcol_10 is null and t5.fcol_17 is null)
group by t2.fcol_7
```


> Block agg-push-down for non-equal-join
> --------------------------------------
>
>                 Key: KYLIN-5839
>                 URL: https://issues.apache.org/jira/browse/KYLIN-5839
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 5.0-beta
>            Reporter: Zhimin Wu
>            Assignee: Zhimin Wu
>            Priority: Major
>             Fix For: 5.0.0
>
>
> The related non-equiv-join sql is as follows. If you want a corresponding 
> equal-join sql, just remove the condition content `or (t2.fcol_10 is null and 
> t5.fcol_17 is null)`. 
> {code:java}
> select t2.fcol_7 fcol_7, count(distinct t2.fcol_6) fcol_6
> from (select t1.company_code fcol_6, t1.type_name fcol_7,
>           case when t1.created_date = t0.fcol_1 then 'TRUE'
>           else 'FALSE' end fcol_10
>       from ( select company_code, created_date, type_name
>             from "DEFAULT"."TEST_AGG_PUSH_DOWN" ) t1
>             join ( select company_code, max(created_date) fcol_1
>                    from "DEFAULT"."TEST_AGG_PUSH_DOWN"
>                    group by company_code
>             ) t0 on t1.company_code = t0.company_code
>     ) t2 join ( select 'TRUE' fcol_17 ) t5
>     on  t2.fcol_10 = t5.fcol_17 or (t2.fcol_10 is null and t5.fcol_17 is null)
> group by t2.fcol_7{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to