ruanhui created CALCITE-6447:
--------------------------------

             Summary: extract common expressions for disjunctions in Join
                 Key: CALCITE-6447
                 URL: https://issues.apache.org/jira/browse/CALCITE-6447
             Project: Calcite
          Issue Type: New Feature
          Components: core
    Affects Versions: 1.37.0
            Reporter: ruanhui
             Fix For: 1.37.0


For SQL:
{code:java}
select * from tbl_a join tbl_b on tbl_a.id = tbl_b.id where (tbl_a.x > 100 and 
tbl_b.y < 10) or (tbl_a.x > 100 and tbl_b.z > 20){code}


we can rewrite it to
{code:java}
select * from tbl_a join tbl_b on tbl_a.id = tbl_b.id where tbl_a.x > 100 and 
(tbl_b.y < 10 or tbl_b.z > 20){code}


And in this way *tbl_a.x > 100* can be pushed down and it is likely that this 
will help reduce the amount of data involved in the join.



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

Reply via email to