francisoliverlee opened a new issue #4018:
URL: https://github.com/apache/incubator-doris/issues/4018
**Describe the bug**
go to **Reproduce
**To Reproduce**
Steps to reproduce the behavior:
1. create table
`CREATE TABLE `vk_tbl_01` (
`pt` date NULL COMMENT "hive分区",
`day` date NULL COMMENT "日期",
) ENGINE=OLAP
DUPLICATE KEY(`pt`, `day`)
COMMENT "OLAP"
PARTITION BY RANGE(`day`)
(PARTITION p20200601 VALUES [('2020-06-01'), ('2020-06-02')),
PARTITION p20200703 VALUES [('2020-07-03'), ('2020-07-04')))
DISTRIBUTED BY HASH(`pt`, `day`, `dpt`, `mgr`, `tl`) BUCKETS 3
PROPERTIES (
"replication_num" = "1",
"dynamic_partition.enable" = "false",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.start" = "-2147483648",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "5",
"in_memory" = "false",
"storage_format" = "DEFAULT"
);`
2. reproduce case sql, notice the where-in ccause
`
SELECT
pt,
DAYOFWEEK(`day`) `week`,
dpt AS `大部`
FROM
vk_tbl_01
WHERE
DAYOFWEEK(`day`) in ('2') limit 10;`
3. right case, notice the where= cause
`SELECT
pt,
DAYOFWEEK(`day`) `week`,
dpt AS `大部`
FROM
vk_tbl_01
WHERE
DAYOFWEEK(`day`) = '2' limit 10;`
**Expected behavior**
return right resullt
**Screenshots**

**code may cause the bug**
`org.apache.doris.planner.RangePartitionPruner.java
the children's type can not be used directly, because the children may be a
function result, the function result's type does not eq with the original
paitition key‘s type

`
** possible solution **
let's take the can-not-work-sql for example
`
SELECT
pt,
DAYOFWEEK(`day`) `week`,
dpt AS `大部`
FROM
vk_tbl_01
WHERE
DAYOFWEEK(`day`) in ('2') limit 10;`
1. day is the partition key, so calc all PARTITION key result using
DAYOFWEEK, we can confirm what partitions 2 in
2. query those partitionns for the result
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]