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


   **Describe the bug**
   `select day from test where day in ('2020-10-32')`, table 'test' is 
parititioned by day. In this case, '2020-10-32' will be taken as CastExpr not 
LiteralExpr, and condition "day in ('2020-10-32')" will not be recognized as 
partitionfilter. This case will scan all partitions. To avoid scall all 
partitions, it is better to filter invalid date value.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. create table:
   CREATE TABLE test (
   date datetime NULL COMMENT "日期",
   day date NULL COMMENT "",
   app_id varchar(1000) NULL COMMENT "",
   device_id int(11) 0 comment ""
   ) ENGINE=OLAP
   DUPLICATE KEY(date, day, app_id)
   COMMENT "OLAP"
   PARTITION BY RANGE(day)()
   DISTRIBUTED BY HASH(device_id) BUCKETS 64
   PROPERTIES (
   "replication_num" = "1",
   "dynamic_partition.enable" = "true",
   "dynamic_partition.time_unit" = "DAY",
   "dynamic_partition.time_zone" = "Asia/Shanghai",
   "dynamic_partition.start" = "-30",
   "dynamic_partition.end" = "3",
   "dynamic_partition.prefix" = "p",
   "dynamic_partition.replication_num" = "1",
   "dynamic_partition.buckets" = "32",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   
   2. insert some data into each partition
   
   3. execute a query which day is invalid, it will scan all partitions
   `explain select day from test where day in ('2020-10-32' );`
   
   4. see the error
   ![2020-10-23 
23-23-59屏幕截图](https://user-images.githubusercontent.com/12771191/97022891-48bc4b80-1587-11eb-874e-f9b5e961f794.png)
   
   **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