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 2022/04/17 13:23:11 UTC

[GitHub] [arrow-datafusion] jackwener opened a new issue, #2256: [Optimizer] Refactor `infer predicate and then convert join`

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   Now 
   
   ```sql
   explain select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0;
   
   It can be transfer
   
   explain select * from t1  inner join t2 on t1.c1 = t2.c2 where t1.c1 > 0;
   ```
   
   But the implementation is a little hack. We can implement it in `optimizer rule` instead of  `planner build--->plan_selection`
   
   We can refactor it and do it using the other optimizer system.
   
   **Describe the solution you'd like**
   #2255 include many rule, some rule is preconditions.
   
   In fact, this should be result of some rule combine.
   
   Transformation path
   ```sql
   select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0;
   -- infer predicate -->
   select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0 and  t2.c1 > 0;
   -- convert outer join -->
   select * from t1 inner join t2 on t1.c1 = t2.c2 where t1.c1 > 0 and  t2.c1 > 0;
   ```
   
   or
   
   ```sql
   select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0;
   -- infer not null -->
   select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0 and t1.c1 is not null;
   -- infer predicate -->
   select * from t1 join t2 on t1.c1 = t2.c2 where t1.c1 > 0 and t1.c1 is not null and t2.c1 > 0 and t2.c1 is not null;
   -- convert outer join -->
   select * from t1 inner join t2 on t1.c1 = t2.c2 where t1.c1 > 0 and t1.c1 is not null and t2.c1 > 0 and t2.c1 is not null;
   ```
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


-- 
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


[GitHub] [arrow-datafusion] jackwener closed issue #2256: [Optimizer] Refactor `convert join`

Posted by GitBox <gi...@apache.org>.
jackwener closed issue #2256: [Optimizer] Refactor `convert join`
URL: https://github.com/apache/arrow-datafusion/issues/2256


-- 
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

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