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

   ### What changes were proposed in this pull request?
   
   Remove dynamic pruning subquery if pruningKey's references is empty. For 
example:
   ```sql
   SELECT f.store_id,
          f.date_id,
          s.state_province
   FROM (SELECT   store_id,
                  date_id,
                  product_id
         FROM   fact_stats
         WHERE  date_id <= 1000
         UNION ALL
         SELECT 4 AS store_id,
                  date_id,
                  product_id
         FROM   fact_sk
         WHERE  date_id >= 1300) f
   JOIN dim_store s
   ON f.store_id = s.store_id
   WHERE s.country IN ('US', 'NL')
   ```
   
   Before this PR | After this PR
   -- | --
   
![image](https://user-images.githubusercontent.com/5399861/170940803-b4d4b93d-96d7-47de-ac22-d13259f3447a.png)
 | 
![image](https://user-images.githubusercontent.com/5399861/170941010-b7eec26e-9f93-4ae6-aa10-aacdde15af0d.png)
   
   ### Why are the changes needed?
   
   Remove useless dynamic pruning subquery because it can't reduce data.
   
   ### 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