starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

[BugFix] create dynamic hour partition table need to set partition co…

Open blanklin030 opened this issue 1 year ago • 4 comments

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

blanklin030 avatar Apr 23 '24 04:04 blanklin030

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 23 '24 04:04 CLAassistant

Quality Gate Failed 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

sonarqubecloud[bot] avatar Apr 23 '24 09:04 sonarqubecloud[bot]

@blanklin030 thanks for your contribution, plz fix the ut first

nshangyiming avatar May 21 '24 02:05 nshangyiming

@blanklin030 thanks for you contribution, please fix the conflicts.

nshangyiming avatar May 30 '24 11:05 nshangyiming

@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?

blanklin030 avatar May 30 '24 12:05 blanklin030

[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]

github-actions[bot] avatar May 30 '24 13:05 github-actions[bot]

[BE Incremental Coverage Report]

:white_check_mark: pass : 0 / 0 (0%)

github-actions[bot] avatar May 30 '24 13:05 github-actions[bot]