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

   # Proposed changes
   
   Issue Number: close #xxx
   When the number of selected partition queried is greater than 1 and there is 
a group by statement, the PartitionCache will not be hit.
   Even the examples provided on the official website and `PartitionCacheTest` 
UT cannot be hit, and PartitionCache is basically unavailable.
   
   
   ## Problem summary
   
   Reproduce:
   ```sql
   create table appevent (
     `eventdate` date NULL,
     `bu_name` varchar(50) NULL,
     `client_type` varchar(50) NULL,
     `userid` varchar(50) NULL
   ) ENGINE=OLAP
   DUPLICATE KEY(`eventdate`)
   PARTITION BY RANGE(`eventdate`)
   (PARTITION p20230101 VALUES [('2023-01-01'), ('2023-01-02')),
   PARTITION p20230102 VALUES [('2023-01-02'), ('2023-01-03')),
   PARTITION p20230103 VALUES [('2023-01-03'), ('2023-01-04')),
   PARTITION p20230104 VALUES [('2023-01-04'), ('2023-01-05')),
   PARTITION p20230105 VALUES [('2023-01-05'), ('2023-01-06')))
   DISTRIBUTED BY HASH(`bu_name`) BUCKETS 3
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 3",
   "in_memory" = "false",
   "storage_format" = "V2"
   )
   
   insert into appevent values('2023-01-01', 'bu1', 'ios', 'user01');
   insert into appevent values('2023-01-02', 'bu1', 'ios', 'user01');
   insert into appevent values('2023-01-03', 'bu1', 'ios', 'user01');
   insert into appevent values('2023-01-04', 'bu1', 'ios', 'user01');
   insert into appevent values('2023-01-05', 'bu1', 'ios', 'user01');
   
   
   SELECT 
       eventdate,count(userid) 
   FROM 
       testdb.appevent 
   WHERE 
       eventdate>="2023-01-01" AND eventdate<="2023-01-05" 
   GROUP BY 
       eventdate 
   ORDER BY 
       eventdate;
   ```
   
   The following logic is triggered when querying:
   ```java
   if (enablePartitionCache() && ((OlapScanNode) 
node).getSelectedPartitionNum() > 1
           && selectStmt.hasGroupByClause()) {
       LOG.debug("more than one partition scanned when qeury has agg, partition 
cache cannot use, queryid {}",
               DebugUtil.printId(queryId));
       return CacheMode.None;
   }
   ```
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## 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