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


   **Describe the bug**
   Doris supports two kinds of cache mode: sql_cache and partition_cache. 
sql_cache takes sql string as key and cache the whole data. partition_cache 
splits the data into many partition data and caches them differently.  
Therefore a query may hit part of the partition_cache data. If a query hits the 
left part of the data, we call the **hit range** is left. If a query hits the 
right part of the data, we call the **hit range** is right. And if a query hits 
the whole part of the data, we call the **hit range** is full.
   
   A query does not hit any partition cache, but the algorithm still returns 
hit range right. 
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. create a table:
   CREATE TABLE `table_date` (
     `event_day` date NULL COMMENT "",
     `siteid` int(11) NULL DEFAULT "10" COMMENT "",
     `citycode` smallint(6) NULL COMMENT "",
     `username` varchar(32) NULL DEFAULT "" COMMENT "",
     `pv` bigint(20) SUM NULL DEFAULT "0" COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`event_day`, `siteid`, `citycode`, `username`)
   COMMENT "OLAP"
   PARTITION BY RANGE(`event_day`)
   (PARTITION p202006 VALUES [('0000-01-01'), ('2020-07-01')),
   PARTITION p202007 VALUES [('2020-07-01'), ('2020-08-01')),
   PARTITION p202008 VALUES [('2020-08-01'), ('2020-09-01')),
   PARTITION p202009 VALUES [('2020-09-01'), ('2020-10-01')),
   PARTITION p202010 VALUES [('2020-10-01'), ('2020-11-01')))
   DISTRIBUTED BY HASH(`siteid`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "V2"
   ); 
   2. enable partition cache
   set enable_partition_cache = true;
   3. add a log to function `handleCacheStmt`
   `LOG.warn("cache-mode:{}, hit-range:{}, cacheResul:{}", mode.name(), 
cacheAnalyzer.getHitRange(), cacheResult);`
   4. execute a query
    select count(*) from table_date where event_day >= "2020-06-02" and 
event_day <= "2020-10-11" group by event_day;
   5. See error
   the log prints as follow:
   `cache-mode:Partition, hit-range:Right, cacheResul:null`
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   **Screenshots**
   If applicable, add screenshots to help explain your problem.
   
   **Desktop (please complete the following information):**
    - OS: [e.g. iOS]
    - Browser [e.g. chrome, safari]
    - Version [e.g. 22]
   
   **Smartphone (please complete the following information):**
    - Device: [e.g. iPhone6]
    - OS: [e.g. iOS8.1]
    - Browser [e.g. stock browser, safari]
    - Version [e.g. 22]
   
   **Additional context**
   Add any other context about the problem here.
   


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

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