starrocks
starrocks copied to clipboard
Partition predicates are not pushed down
The current logic is that after the partition is trimmed, the partition predicate will be deleted from the predicate. Is this reasonable? There is a problem now. There are two columns A and B. Column A is used as the partition key. The bucket key is (A, B). Now the query uses A=x and B=x. This cannot trim the bucket.
Steps to reproduce the behavior (Required)
CREATE TABLE `Test` (
`dim_dt` date NOT NULL COMMENT "",
`dim_class_id` int(11) NOT NULL COMMENT "",
`dim_week_start_time` bigint(20) NOT NULL COMMENT "",
`deleted` int(11) NOT NULL COMMENT "
) ENGINE=OLAP
PRIMARY KEY(`dim_dt`, `dim_class_id`, `dim_week_start_time`)
COMMENT ""
PARTITION BY RANGE(`dim_dt`)
(PARTITION p20241204 VALUES [("2024-12-04"), ("2024-12-05")),
PARTITION p20241205 VALUES [("2024-12-05"), ("2024-12-06")),
PARTITION p20241206 VALUES [("2024-12-06"), ("2024-12-07")),
PARTITION p20241207 VALUES [("2024-12-07"), ("2024-12-08")),
PARTITION p20241208 VALUES [("2024-12-08"), ("2024-12-09")),
PARTITION p20241211 VALUES [("2024-12-11"), ("2024-12-12")),
PARTITION p20241212 VALUES [("2024-12-12"), ("2024-12-13")),
PARTITION p20241213 VALUES [("2024-12-13"), ("2024-12-14")),
PARTITION p20241214 VALUES [("2024-12-14"), ("2024-12-15")))
DISTRIBUTED BY HASH(`dim_dt`, `dim_class_id`) BUCKETS 8
PROPERTIES (
"compression" = "LZ4",
"datacache.enable" = "true",
"dynamic_partition.buckets" = "32",
"dynamic_partition.enable" = "true",
"dynamic_partition.end" = "3",
"dynamic_partition.history_partition_num" = "0",
"dynamic_partition.prefix" = "p",
"dynamic_partition.start" = "-7",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"enable_async_write_back" = "false",
"enable_persistent_index" = "false",
"replication_num" = "1",
"storage_volume" = "builtin_storage_volume"
);
insert into sys_full_finish_interview_class_stat_v12 values("2024-12-05",1,1,1);
explain select dim_class_id from sys_full_finish_interview_class_stat_v12 where dim_dt = '2024-12-05' and dim_class_id in (1);
Expected behavior (Required)
Real behavior (Required)
StarRocks version (Required)
- You can get the StarRocks version by executing SQL
select current_version()
this case 2.5 works well. 3.x will't work
We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!