Skip to content

[Bug] partition cache match failed #5059

@xinghuayu007

Description

@xinghuayu007

Describe the bug
When partition cache is not cached continuely, range query may fail. For example, partition key 20201011 and 20201013 is cached, but rang query is between 20201011 and 20201013, the query will not hit the cache.

To Reproduce
Steps to reproduce the behavior:

  1. create a table with paritition 20201011 to 20201013
    CREATE TABLE dynamic_partition (
    k1 bigint(20) NULL COMMENT "",
    k2 int(11) NULL COMMENT "",
    k3 smallint(6) NULL COMMENT ""
    ) ENGINE=OLAP
    DUPLICATE KEY(k1, k2, k3)
    COMMENT "OLAP"
    PARTITION BY RANGE(k1)
    (PARTITION p20201209 VALUES [("20201209"), ("20201210")),
    PARTITION p20201210 VALUES [("20201210"), ("20201211")),
    PARTITION p20201211 VALUES [("20201211"), ("20201212")),
    PARTITION p20201212 VALUES [("20201212"), ("20201213")),
    PARTITION p20201213 VALUES [("20201213"), ("20201214")),
    PARTITION p20201214 VALUES [("20201214"), ("20201215")),
    PARTITION p20201215 VALUES [("20201215"), ("20201216")),
    PARTITION p20201216 VALUES [("20201216"), ("20201217")))
    DISTRIBUTED BY HASH(k2) BUCKETS 32
    PROPERTIES (
    "replication_num" = "1",
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.time_zone" = "Asia/Shanghai",
    "dynamic_partition.start" = "-6",
    "dynamic_partition.end" = "6",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.replication_num" = "1",
    "dynamic_partition.buckets" = "32",
    "in_memory" = "false",
    "storage_format" = "V2"
    );
  2. insert into parition 20201011, 20201012,20201013 one item of data
  3. enable partition cache and execute a query twice:
    set enable_partition_cache=true;
    select k1 from dynamic_partition where k1 >= 20201011 and k1 <= 20201213 group by k1;
  4. can not hit the cache

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sql/cacheIssues or PRs related to sql cache

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions