You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/11 20:22:35 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #4877: Support non-equijoin predicate for EliminateCrossJoin #4866

alamb opened a new issue, #4877:
URL: https://github.com/apache/arrow-datafusion/issues/4877

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   Follow on to https://github.com/apache/arrow-datafusion/issues/4844
   
   The fix for incorrect answers in https://github.com/apache/arrow-datafusion/pull/4869 was to skip the optimizaton if non equijoins were present. 
   
   This ticket tracks actually supporting removing crossjoins when filters are present
   
   Currently datafusion will loss the `join filter` of inner join when run `EliminateCrossJoin` rule. Following are query and optimized logical plan:
   ```sql
   explain verbose select t1.t1_id,t2.t2_id,t3.t3_id 
                    from t1 
                    inner join t2 on t1.t1_id > t2.t2_id 
                    cross join t3 
                    where t3.t3_int > t1.t1_int and t1.t1_int > t2.t2_int;
   ```
   
   
   This is because `EliminateCrossJoin` only consider equijoin predicate.
   
   The idea is to rewrite `EliminateCrossJoin`, and choose the right input of join based on both equijoin and  non-equijoin predicate. After this pr, the logical plan will be:
   ```sql
         Projection: t1.t1_id, t2.t2_id, t3.t3_id
           Inner Join:  Filter: t3.t3_int > t1.t1_int
             Inner Join:  Filter: t1.t1_int > t2.t2_int AND t1.t1_id > t2.t2_id
               TableScan: t1 projection=[t1_id, t1_int]
               TableScan: t2 projection=[t2_id, t2_int]
             TableScan: t3 projection=[t3_id, t3_int]
   ```
   
   The join filter should not be lost.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support non-equijoin predicate for EliminateCrossJoin #4866 [datafusion]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #4877:
URL: https://github.com/apache/datafusion/issues/4877#issuecomment-2422424734

   I am looking into this together with https://github.com/apache/datafusion/pull/12985


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support non-equijoin predicate for EliminateCrossJoin #4866 [datafusion]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #4877:
URL: https://github.com/apache/datafusion/issues/4877#issuecomment-2422513140

   Looks like this already gives this result based filter pushdown after https://github.com/apache/datafusion/pull/5770/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support non-equijoin predicate for EliminateCrossJoin #4866 [datafusion]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #4877:
URL: https://github.com/apache/datafusion/issues/4877#issuecomment-2422558891

   In many situations we create good plans for filter + joins. We should have some counter-examples where we create suboptimal plans.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support non-equijoin predicate for EliminateCrossJoin #4866 [datafusion]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan closed issue #4877: Support non-equijoin predicate for EliminateCrossJoin #4866
URL: https://github.com/apache/datafusion/issues/4877


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org