wangshuo128 opened a new issue #7433:
URL: https://github.com/apache/incubator-doris/issues/7433


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Description
   
   In the current code, partition prune has some issues.
   1.  Disjunctive predicates can't be handled.
   Let's say we have a table `t` with partition column `dt`
   ```sql
   CREATE TABLE `t` (
     `dt` int(11) NULL COMMENT "",
     `k1` int(11) NULL COMMENT "",
     `k2` int(11) NULL COMMENT "",
     `k3` int(11) NULL COMMENT "",
     `k4` int(11) NULL COMMENT ""
   ) DUPLICATE KEY(`dt`, `k1`, `k2`, `k3`, `k4`)
   PARTITION BY RANGE(`dt`)
   (PARTITION p20211121 VALUES LESS THAN ("20211121"),
   PARTITION p20211122 VALUES [("20211121"), ("20211122")),
   PARTITION p20211123 VALUES [("20211122"), ("20211123")),
   PARTITION p20211124 VALUES [("20211123"), ("20211124")),
   PARTITION p20211125 VALUES [("20211124"), ("20211125")),
   PARTITION p20211126 VALUES [("20211125"), ("20211126")),
   PARTITION p20211127 VALUES [("20211126"), ("20211127")),
   PARTITION p20211128 VALUES [("20211127"), ("20211128")))
   DISTRIBUTED BY HASH(`k1`) BUCKETS 60
   PROPERTIES('replication_num' = '1');
   ```
   All the partitions would be scanned if we run SQL with disjunctive 
predicates, e.g., `SELECT * FROM  t WHERE dt=20211123 OR dt=20211124`.
   
   2.  Can't handle well for multiple columns partition.
   
https://github.com/apache/incubator-doris/blob/e74e55d2a4b9aa233f61ab4c35fe5e29d3a33d89/fe/fe-core/src/test/java/org/apache/doris/analysis/ListPartitionPrunerTest.java#L140-L141
   This test case should return 1 partition instead of 2.
   
   ### Solution
   
   I'd like to implement a V2 version of partition prune algorithm.
   
   1. Support prune partitions for disjunctive predicates.
   2. Optimize for multiple columns partition prune.
   
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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