Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] (good first issue) Add trim to table attributes during table creation #47851

Open
2 of 3 tasks
deardeng opened this issue Feb 13, 2025 · 5 comments
Open
2 of 3 tasks

Comments

@deardeng
Copy link
Contributor

deardeng commented Feb 13, 2025

Search before asking

  • I had searched in the issues and found no similar issues.

Version

doris master

What's Wrong?

Fix many properties in the table building attribute that do not have a trim, which may result in errors in the subsequent process

BUG!

  1. first after create table , show create table "dynamic_partition.start " = "-7"
  2. alter table tbl1 set ( "dynamic_partition.start " = "-2147483648"); return ok
  3. There is an extra space after 'dynamic_partition.start ' here, in step 1
  4. but not work in show create table, it dynamic_partition.start still old value
  5. I expect in show create table result dynamic_partition.start = -2147483648, not -7
mysql> CREATE TABLE tbl1
    -> (
    ->     k1 DATE,
    ->     k2 varchar(20)
    -> )
DISTRIBUTED BY HASH(k1)
    -> PARTITION BY RANGE(k1) ()
    -> DISTRIBUTED BY HASH(k1)
    -> PROPERTIES
    -> (
    ->   "replication_num"="1",
    ->     "dynamic_partition.enable" = "true",
    ->     "dynamic_partition.time_unit" = "DAY",
    ->     "dynamic_partition.start" = "-7",
    ->     "dynamic_partition.end" = "3",
    ->     "dynamic_partition.prefix" = "p",
    ->     "dynamic_partition.buckets" = "32"
    -> );
Query OK, 0 rows affected (0.09 sec)mysql> alter table tbl1 set ( "dynamic_partition.start " = "-2147483648");
Query OK, 0 rows affected (0.00 sec)mysql> show create table tbl1;
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tbl1  | CREATE TABLE `tbl1` (
  `k1` date NULL,
  `k2` varchar(20) NULL
) ENGINE=OLAP
DUPLICATE KEY(`k1`, `k2`)
PARTITION BY RANGE(`k1`)
(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 p20241209 VALUES [('2024-12-09'), ('2024-12-10')))
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"min_load_replica_num" = "-1",
"is_being_synced" = "false",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-7",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.replication_allocation" = "tag.location.default: 1",
"dynamic_partition.buckets" = "32",
"dynamic_partition.create_history_partition" = "false",
"dynamic_partition.history_partition_num" = "-1",
"dynamic_partition.hot_partition_num" = "0",
"dynamic_partition.reserved_history_periods" = "NULL",
"dynamic_partition.storage_policy" = "",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V1",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728"
); |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)mysql>  
Image

What You Expected?

  1. trime table properties when create table or alter table
  2. and add some regression case

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@chuang-wang-pre
Copy link

chuang-wang-pre commented Feb 14, 2025

What version of Doris are you using? The new version of Doris does not have this issue. When executing the above alter statement, an error message "errCode = 2, detailMessage = Invalid dynamic partition properties: dynamic_partition.start" will be reported. @deardeng

@deardeng
Copy link
Contributor Author

What version of Doris are you using? The new version of Doris does not have this issue. When executing the above alter statement, an error message "errCode = 2, detailMessage = Invalid dynamic partition properties: dynamic_partition.start" will be reported. @deardeng
@chuang-wang-pre

you can add a regression case to test it. Use the following testing steps

  1. first after create table , show create table "dynamic_partition.start " = "-7"
  2. alter table tbl1 set ( "dynamic_partition.start " = "-2147483648"); return ok
  3. There is an extra space after 'dynamic_partition.start ' here, in step 1
  4. but not work in show create table, it dynamic_partition.start still old value
  5. expect in show create table result dynamic_partition.start = -2147483648, not -7

@deardeng
Copy link
Contributor Author

What version of Doris are you using? The new version of Doris does not have this issue. When executing the above alter statement, an error message "errCode = 2, detailMessage = Invalid dynamic partition properties: dynamic_partition.start" will be reported. @deardeng

@chuang-wang-pre this error "errCode = 2, detailMessage = Invalid dynamic partition properties: dynamic_partition.start",

It shouldn't happen because the dynamic partition table has a start attribute. Please check if there are spaces before and after dynamic_partition.start in the table creation statement

@felixwluo
Copy link
Contributor

I couldn’t reproduce it in the master test either. If there is a space after "dynamic_partition.start " = "-7" in the CREATE TABLE statement, the table tbl1 cannot be created successfully. However, if there is a space before " dynamic_partition.start" = "-7", the table tbl1 can be created. When executing ALTER TABLE tbl1 SET ("dynamic_partition.start " = "-2147483648"); it throws the error ERROR 1105 (HY000): errCode = 2, detailMessage = Invalid dynamic partition properties: dynamic_partition.start

@deardeng
Copy link
Contributor Author

dynamic_partition.sta

@felixwluo 这里alter不应该抛出异常的,因为动态表里面是有dynamic_partition.start这个属性的,所以肯定table 保存的属性和 alter传入的属性,字符串匹配不上的,你可以调试看看的,寻找一下原因的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants