You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "ygf11 (via GitHub)" <gi...@apache.org> on 2023/02/20 12:10:17 UTC

[GitHub] [arrow-datafusion] ygf11 opened a new issue, #5344: Add back Distinct for where-exists if subquery is a DISTINCT

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   After #5264, we support rewriting more `where-exists` to join, but do not add back the `Distinct`.
   For query:
   ```sql
   SELECT t1.t1_id
   FROM   t1
   WHERE  EXISTS(SELECT DISTINCT t2_int
                 FROM   t2
                 WHERE  t2.t2_id > t1.t1_id); 
   
   # current logical plan:
   Projection: t1.t1_id                                                                                                                
     LeftSemi Join:  Filter: t2.t2_id > t1.t1_id                                                                                                               
       TableScan: t1 projection=[t1_id]                                                                                                       
       Projection: t2.t2_id # DISTINCT is not added back                                                                                                                                    
         TableScan: t2 projection=[t2_id]
   ```
   Although the execution result is correct, we should add back the `DISTINCT`.
   In some cases, `DISTINCT` can filter a lot rows before join, we should let `user` choose.  
   
   **Describe the solution you'd like**
   Add back `Distinct` if the subquery is a `DISTINCT`.
   
   **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 #5344: Add back Distinct for where-exists if subquery is a DISTINCT

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener closed issue #5344: Add back Distinct for where-exists if subquery is a DISTINCT
URL: https://github.com/apache/arrow-datafusion/issues/5344


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