wangyum opened a new pull request, #36909:
URL: https://github.com/apache/spark/pull/36909

   ### What changes were proposed in this pull request?
   
   This PR enhances https://github.com/apache/spark/pull/35216 to support more 
cases. For example:
   ```sql
   CREATE TABLE t1(id int) using parquet;
   CREATE TABLE t2(id int, type string) using parquet;
   CREATE TEMP VIEW v1 AS SELECT id, 't' AS type FROM t1;
   
   EXPLAIN EXTENDED SELECT * FROM v1 WHERE type IN (SELECT type FROM t2);
   ```
   
   Before this PR:
   ```
   === Result of Batch RewriteSubquery ===
    Project [id#241, t AS type#246]                            Project [id#241, 
t AS type#246]
   !+- Filter t IN (list#243 [])                               +- Join 
LeftSemi, (t = type#248)
   !   :  +- Project [type#248]                                   :- Relation 
default.t1[id#241] parquet
   !   :     +- Relation default.t2[id#247,type#248] parquet      +- Project 
[type#248]
   !   +- Relation default.t1[id#241] parquet                        +- 
Relation default.t2[id#247,type#248] parquet
   ```
   
   After this PR:
   ```
   === Result of Batch RewriteSubquery ===
    Project [id#241, t AS type#246]                            Project [id#241, 
t AS type#246]
   !+- Filter t IN (list#243 [])                               +- Join LeftSemi
   !   :  +- Project [type#248]                                   :- Relation 
default.t1[id#241] parquet
   !   :     +- Relation default.t2[id#247,type#248] parquet      +- 
GlobalLimit 1
   !   +- Relation default.t1[id#241] parquet                        +- 
LocalLimit 1
   !                                                                    +- 
Project
   !                                                                       +- 
Filter (t = type#248)
   !                                                                          
+- Relation default.t2[id#247,type#248] parquet
   ```
   
   
   ### Why are the changes needed?
   
   Improve query performance.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Unit test.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to