morrySnow opened a new pull request, #9819:
URL: https://github.com/apache/incubator-doris/pull/9819

   # Proposed changes
   
   This PR try to remove redundant conjuncts on plan node when generate Single 
Node Plan
   
   ## Problem Summary:
   
   Currently, Doris cannot remove redundant expression on anywhere. We can 
reproduce follow these SQL:
   ```sql
   -- create table
   CREATE TABLE `t1` (
     `k1` int(11) NULL COMMENT "",
     `v1` int(11) NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`k1`, `v1`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2"
   )
   
   -- query
   explain select v1 from t1 where k1 = 1 and k1 = 1;
   ```
   
   current plan like this:
   ```
   +-----------------------------------------------------------------+
   | Explain String                                                  |
   +-----------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                 |
   |  OUTPUT EXPRS:`v1`                                              |
   |   PARTITION: HASH_PARTITIONED: `default_cluster:test`.`t1`.`k1` |
   |                                                                 |
   |   VRESULT SINK                                                  |
   |                                                                 |
   |   0:VOlapScanNode                                               |
   |      TABLE: t1                                                  |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo              |
   |      PREDICATES: `k1` = 1, `k1` = 1                             |
   |      partitions=0/1                                             |
   |      rollup: null                                               |
   |      tabletRatio=0/0                                            |
   |      tabletList=                                                |
   |      cardinality=0                                              |
   |      avgRowSize=8.0                                             |
   |      numNodes=1                                                 |
   +-----------------------------------------------------------------+
   ```
   
   after this PR, the plan is like this:
   ```
   +-----------------------------------------------------------------+
   | Explain String                                                  |
   +-----------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                 |
   |  OUTPUT EXPRS:`v1`                                              |
   |   PARTITION: HASH_PARTITIONED: `default_cluster:test`.`t1`.`k1` |
   |                                                                 |
   |   VRESULT SINK                                                  |
   |                                                                 |
   |   0:VOlapScanNode                                               |
   |      TABLE: t1                                                  |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo              |
   |      PREDICATES: `k1` = 1                                       |
   |      partitions=0/1                                             |
   |      rollup: null                                               |
   |      tabletRatio=0/0                                            |
   |      tabletList=                                                |
   |      cardinality=0                                              |
   |      avgRowSize=8.0                                             |
   |      numNodes=1                                                 |
   +-----------------------------------------------------------------+
   ```
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: No
   2. Has unit tests been added: No
   3. Has document been added or modified: No Need
   4. Does it need to update dependencies: No
   5. Are there any changes that cannot be rolled back: No
   
   ## Further comments
   
   Let's see could this PR broken any UT or regression test.
   If no UT and  regression test be broken, i will add UT later.


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