[BugFix] create dynamic hour partition table need to set partition co…
Why I'm doing:
mysql> CREATE TABLE `test_111` (
-> `project_id` bigint(20) NOT NULL DEFAULT "0" COMMENT "",
-> `dt` date NOT NULL DEFAULT "1970-01-01" COMMENT "",
-> `project_code` varchar(65533) NOT NULL DEFAULT "" COMMENT "",
-> `project_name` varchar(65533) NOT NULL DEFAULT "" COMMENT "",
-> `owners` varchar(65533) NOT NULL DEFAULT "" COMMENT ""
-> ) ENGINE=OLAP
-> PRIMARY KEY(`project_id`, `dt`)
-> COMMENT "指标管理工具维表加速创建,维度ID=30004281"
-> PARTITION BY RANGE(`dt`)
-> (START("2024-03-24 00:00:00") END("2024-04-02 00:00:00") EVERY(INTERVAL 1 HOUR))
-> DISTRIBUTED BY HASH(`project_id`) BUCKETS 5
-> PROPERTIES (
-> "replication_num" = "1",
-> "dynamic_partition.enable" = "true",
-> "dynamic_partition.time_unit" = "HOUR",
-> "dynamic_partition.time_zone" = "Asia/Shanghai",
-> "dynamic_partition.start" = "-360",
-> "dynamic_partition.end" = "1",
-> "dynamic_partition.prefix" = "p",
-> "dynamic_partition.buckets" = "100",
-> "dynamic_partition.history_partition_num" = "0",
-> "in_memory" = "false",
-> "storage_format" = "DEFAULT",
-> "enable_persistent_index" = "true",
-> "compression" = "LZ4"
-> );
Query OK, 0 rows affected (0.02 sec)
What I'm doing:
mysql> CREATE TABLE `test_111` (
-> `project_id` bigint(20) NOT NULL DEFAULT "0" COMMENT "",
-> `dt` date NOT NULL DEFAULT "1970-01-01" COMMENT "",
-> `project_code` varchar(65533) NOT NULL DEFAULT "" COMMENT "",
-> `project_name` varchar(65533) NOT NULL DEFAULT "" COMMENT "",
-> `owners` varchar(65533) NOT NULL DEFAULT "" COMMENT ""
-> ) ENGINE=OLAP
-> PRIMARY KEY(`project_id`, `dt`)
-> COMMENT "指标管理工具维表加速创建,维度ID=30004281"
-> PARTITION BY RANGE(`dt`)
-> (START("2024-03-24 00:00:00") END("2024-04-02 00:00:00") EVERY(INTERVAL 1 HOUR))
-> DISTRIBUTED BY HASH(`project_id`) BUCKETS 5
-> PROPERTIES (
-> "replication_num" = "1",
-> "dynamic_partition.enable" = "true",
-> "dynamic_partition.time_unit" = "HOUR",
-> "dynamic_partition.time_zone" = "Asia/Shanghai",
-> "dynamic_partition.start" = "-360",
-> "dynamic_partition.end" = "1",
-> "dynamic_partition.prefix" = "p",
-> "dynamic_partition.buckets" = "100",
-> "dynamic_partition.history_partition_num" = "0",
-> "in_memory" = "false",
-> "storage_format" = "DEFAULT",
-> "enable_persistent_index" = "true",
-> "compression" = "LZ4"
-> );
ERROR 1064 (HY000): Dynamic partition tables that are partitioned by hours need to set the partition field type to datetime
Fixes #44564
What type of PR is this:
- [x] BugFix
- [ ] Feature
- [ ] Enhancement
- [ ] Refactor
- [ ] UT
- [ ] Doc
- [ ] Tool
Does this PR entail a change in behavior?
- [ ] Yes, this PR will result in a change in behavior.
- [x] No, this PR will not result in a change in behavior.
If yes, please specify the type of change:
- [ ] Interface/UI changes: syntax, type conversion, expression evaluation, display information
- [ ] Parameter changes: default values, similar parameters but with different default values
- [ ] Policy changes: use new policy to replace old one, functionality automatically enabled
- [ ] Feature removed
- [ ] Miscellaneous: upgrade & downgrade compatibility, etc.
Checklist:
- [x] I have added test cases for my bug fix or my new feature
- [ ] This pr needs user documentation (for new or modified features or behaviors)
- [ ] I have added documentation for my new feature or new function
- [ ] This is a backport pr
Bugfix cherry-pick branch check:
- [x] I have checked the version labels which the pr will be auto-backported to the target branch
- [x] 3.3
- [x] 3.2
- [x] 3.1
- [x] 3.0
- [x] 2.5
Quality Gate failed
Failed conditions
B Maintainability Rating on New Code (required ≥ A)
See analysis details on SonarCloud
Catch issues before they fail your Quality Gate with our IDE extension
SonarLint
@blanklin030 thanks for your contribution, plz fix the ut first
@blanklin030 thanks for you contribution, please fix the conflicts.
@blanklin030 thanks for you contribution, please fix the conflicts.
hello @nshangyiming ,I've resolved these code conflicts,please help to check if there are still problems?
[FE Incremental Coverage Report]
:white_check_mark: pass : 21 / 25 (84.00%)
file detail
| path | covered_line | new_line | coverage | not_covered_line_detail | |
|---|---|---|---|---|---|
| :large_blue_circle: | com/starrocks/sql/analyzer/CreateTableAnalyzer.java | 21 | 25 | 84.00% | [499, 521, 524, 525] |
[BE Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)