-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
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:
- create a table:
CREATE TABLEtable_date(
event_daydate NULL COMMENT "",
siteidint(11) NULL DEFAULT "10" COMMENT "",
citycodesmallint(6) NULL COMMENT "",
usernamevarchar(32) NULL DEFAULT "" COMMENT "",
pvbigint(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"
); - enable partition cache
set enable_partition_cache = true; - add a log to function
handleCacheStmt
LOG.warn("cache-mode:{}, hit-range:{}, cacheResul:{}", mode.name(), cacheAnalyzer.getHitRange(), cacheResult); - execute a query
select count(*) from table_date where event_day >= "2020-06-02" and event_day <= "2020-10-11" group by event_day; - 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.