Reminiscent opened a new pull request, #20161:
URL: https://github.com/apache/doris/pull/20161

   …rule
   
   ## Proposed changes
   Support the rewrite rule for push-down filter through sort.
   We can directly push-down the filter through sort without any conditions 
check.
   
   Before this PR:
   ```
   mysql> explain select * from (select * from t1 order by a) t2 where t2.b > 2;
   +-------------------------------------------------------------+
   | Explain String                                              |
   +-------------------------------------------------------------+
   | PLAN FRAGMENT 0                                             |
   |   OUTPUT EXPRS:                                             |
   |     a[#2]                                                   |
   |     b[#3]                                                   |
   |   PARTITION: UNPARTITIONED                                  |
   |                                                             |
   |   VRESULT SINK                                              |
   |                                                             |
   |   3:VSELECT                                                 |
   |   |  predicates: b[#3] > 2                                  |
   |   |                                                         |
   |   2:VMERGING-EXCHANGE                                       |
   |      offset: 0                                              |
   |                                                             |
   | PLAN FRAGMENT 1                                             |
   |                                                             |
   |   PARTITION: HASH_PARTITIONED: a[#0]                        |
   |                                                             |
   |   STREAM DATA SINK                                          |
   |     EXCHANGE ID: 02                                         |
   |     UNPARTITIONED                                           |
   |                                                             |
   |   1:VTOP-N                                                  |
   |   |  order by: a[#2] ASC                                    |
   |   |  offset: 0                                              |
   |   |                                                         |
   |   0:VOlapScanNode                                           |
   |      TABLE: default_cluster:test.t1(t1), PREAGGREGATION: ON |
   |      partitions=0/1, tablets=0/0, tabletList=               |
   |      cardinality=1, avgRowSize=0.0, numNodes=1              |
   +-------------------------------------------------------------+
   30 rows in set (0.06 sec)
   ```
   
   After this PR:
   ```
   mysql> explain select * from (select * from t1 order by a) t2 where t2.b > 2;
   +-------------------------------------------------------------+
   | Explain String                                              |
   +-------------------------------------------------------------+
   | PLAN FRAGMENT 0                                             |
   |   OUTPUT EXPRS:                                             |
   |     a[#2]                                                   |
   |     b[#3]                                                   |
   |   PARTITION: UNPARTITIONED                                  |
   |                                                             |
   |   VRESULT SINK                                              |
   |                                                             |
   |   2:VMERGING-EXCHANGE                                       |
   |      offset: 0                                              |
   |                                                             |
   | PLAN FRAGMENT 1                                             |
   |                                                             |
   |   PARTITION: HASH_PARTITIONED: a[#0]                        |
   |                                                             |
   |   STREAM DATA SINK                                          |
   |     EXCHANGE ID: 02                                         |
   |     UNPARTITIONED                                           |
   |                                                             |
   |   1:VTOP-N                                                  |
   |   |  order by: a[#2] ASC                                    |
   |   |  offset: 0                                              |
   |   |                                                         |
   |   0:VOlapScanNode                                           |
   |      TABLE: default_cluster:test.t1(t1), PREAGGREGATION: ON |
   |      PREDICATES: b[#1] > 2                                  |
   |      partitions=0/1, tablets=0/0, tabletList=               |
   |      cardinality=1, avgRowSize=0.0, numNodes=1              |
   +-------------------------------------------------------------+
   28 rows in set (0.40 sec)
   ```
   
   <--Describe your changes.-->
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to