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

List Partition table doesn't support subpartition but is created successfully without any warnings #41198

Closed
TonsnakeLin opened this issue Feb 8, 2023 · 2 comments · Fixed by #41207
Labels

Comments

@TonsnakeLin
Copy link
Contributor

TonsnakeLin commented Feb 8, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE IF EXISTS thash14;
CREATE TABLE thash14 (
    col1 INT NOT NULL,
    col2 INT NOT NULL,
    col3 INT NOT NULL,
    col4 INT NOT NULL,
    primary KEY (col1,col3)
)
PARTITION BY LIST(col1)
SUBPARTITION BY HASH(col3) SUBPARTITIONS 2 
(
	PARTITION p1 VALUES IN (1, 2, 3, 4, 5),
	PARTITION p2 VALUES IN (6, 7, 8, 9, 10),
	PARTITION p3 VALUES IN (11, 12, 13, 14, 15)
);

2. What did you expect to see? (Required)

table is not created, or created with a warning that indicates list partition table doesn't support subpartition.

3. What did you see instead (Required)

table created successfully.

4. What is your TiDB version? (Required)

Release Version: v6.2.0-alpha-2066-g62e8709-dirty
Edition: Community
Git Commit Hash: 62e8709
Git Branch: key-partition
UTC Build Time: 2023-02-08 07:26:38
GoVersion: go1.19
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv

@TonsnakeLin TonsnakeLin added the type/bug The issue is confirmed as a bug. label Feb 8, 2023
@mjonss
Copy link
Contributor

mjonss commented Feb 8, 2023

A warning is given for range partition + subpartitioned CREATE TABLE:

tidb> create table t (a int) partition by range (a) subpartition by hash (a) subpartitions 2 (partition pNeg values less than (0), partition pPos values less than (MAXVALUE)) ;
Query OK, 0 rows affected, 1 warning (0.05 sec)

tidb> show warnings;
+---------+------+---------------------------------------------------------+
| Level   | Code | Message                                                 |
+---------+------+---------------------------------------------------------+
| Warning | 8200 | Unsupported partition type RANGE, treat as normal table |
+---------+------+---------------------------------------------------------+
1 row in set (0.00 sec)

But I agree that warnings are often ignored, and it is surprising to the the table created as a non-partitioned table.

@mjonss
Copy link
Contributor

mjonss commented Feb 8, 2023

In v6.5.0, it will create a partitioned table, but without subpartitions (which I think is better than no partitions at all):

tidb> CREATE TABLE thash14 ( col1 INT NOT NULL, col2 INT NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, primary KEY (col1,col3) ) PARTITION BY LIST(col1) SUBPARTITION BY HASH(col3) SUBPARTITIONS 2 ( PARTITION p1 VALUES IN (1, 2, 3, 4, 5), PARTITION p2 VALUES IN (6, 7, 8, 9, 10), PARTITION p3 VALUES IN (11, 12, 13, 14, 15) );
Query OK, 0 rows affected (0.09 sec)

tidb> show create table thash14\G
*************************** 1. row ***************************
       Table: thash14
Create Table: CREATE TABLE `thash14` (
  `col1` int(11) NOT NULL,
  `col2` int(11) NOT NULL,
  `col3` int(11) NOT NULL,
  `col4` int(11) NOT NULL,
  PRIMARY KEY (`col1`,`col3`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY LIST (`col1`)
(PARTITION `p1` VALUES IN (1,2,3,4,5),
 PARTITION `p2` VALUES IN (6,7,8,9,10),
 PARTITION `p3` VALUES IN (11,12,13,14,15))
1 row in set (0.00 sec)

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

Successfully merging a pull request may close this issue.

4 participants