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

   ### What changes were proposed in this pull request?
   
   This PR enhances `PruneFilters` to  push `EqualTo` with `Literal` to other 
conditions.  For example:
   ```sql
   CREATE TABLE t1 (
     id DECIMAL(18,0),
     event_dt DATE,
     cmpgn_run_dt DATE)
   USING parquet
   PARTITIONED BY (cmpgn_run_dt);
   
   SELECT * FROM t1 WHERE CMPGN_RUN_DT >= date_sub(EVENT_DT,2) AND CMPGN_RUN_DT 
<= EVENT_DT AND EVENT_DT ='2022-04-05';
   ```
   
   After this PR:
   ```
   == Optimized Logical Plan ==
   Filter ((((isnotnull(CMPGN_RUN_DT#2) AND isnotnull(EVENT_DT#1)) AND 
(CMPGN_RUN_DT#2 >= 2022-04-03)) AND (CMPGN_RUN_DT#2 <= 2022-04-05)) AND 
(EVENT_DT#1 = 2022-04-05))
   +- Relation default.t1[id#0,event_dt#1,cmpgn_run_dt#2] parquet
   ```
   
   ### Why are the changes needed?
   
   Simplify filter condition to 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: reviews-unsubscr...@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to