You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2023/08/15 03:03:41 UTC

[doris] branch branch-2.0 updated: [branch-2.0](autoinc) Temporarily disable auto increment column feature in branch-2.0 (#22977)

This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new e87581cb46 [branch-2.0](autoinc) Temporarily disable auto increment column feature in branch-2.0 (#22977)
e87581cb46 is described below

commit e87581cb46b11b405fc8c0cf0879c714a1030c7c
Author: bobhan1 <bh...@outlook.com>
AuthorDate: Tue Aug 15 11:03:34 2023 +0800

    [branch-2.0](autoinc) Temporarily disable auto increment column feature in branch-2.0 (#22977)
---
 .../java/org/apache/doris/common/ErrorCode.java    |   5 +-
 .../apache/doris/datasource/InternalCatalog.java   |  17 +-
 .../unique/test_unique_table_auto_inc.out          | 155 ---------
 .../unique/test_unique_table_auto_inc.groovy       | 346 ---------------------
 4 files changed, 5 insertions(+), 518 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
index c827a41314..3d1b9da6fd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
@@ -1205,7 +1205,10 @@ public enum ErrorCode {
             "the auto increment must be BIGINT type."),
 
     ERR_AUTO_INCREMENT_COLUMN_NOT_INT_DUPLICATE_TABLE(5096, new byte[]{'4', '2', '0', '0', '0'},
-            "the auto increment is only supported in duplicate table.");
+            "the auto increment is only supported in duplicate table."),
+
+    ERR_AUTO_INCREMENT_COLUMN_NOT_SUPPORTED(5097, new byte[]{'4', '2', '0', '0', '0'},
+            "auto increment column is not supported currently.");
 
     // This is error code
     private final int code;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 661e3eab04..0ad261ad9b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -2795,24 +2795,9 @@ public class InternalCatalog implements CatalogIf<Database> {
         boolean encounterAutoIncColumn = false;
         for (Column column : columns) {
             if (column.isAutoInc()) {
-                if (encounterAutoIncColumn) {
-                    ErrorReport.reportDdlException(ErrorCode.ERR_MORE_THAN_ONE_AUTO_INCREMENT_COLUMN);
-                }
-                encounterAutoIncColumn = true;
-                if (column.isAllowNull()) {
-                    ErrorReport.reportDdlException(ErrorCode.ERR_AUTO_INCREMENT_COLUMN_NULLABLE);
-                }
-                if (column.getDefaultValue() != null) {
-                    ErrorReport.reportDdlException(ErrorCode.ERR_AUTO_INCREMENT_COLUMN_WITH_DEFAULT_VALUE);
-                }
-                if (!column.getType().isBigIntType()) {
-                    ErrorReport.reportDdlException(ErrorCode.ERR_AUTO_INCREMENT_COLUMN_NOT_BIGINT_TYPE);
-                }
+                ErrorReport.reportDdlException(ErrorCode.ERR_AUTO_INCREMENT_COLUMN_NOT_SUPPORTED);
             }
         }
-        if (encounterAutoIncColumn && type != KeysType.DUP_KEYS) {
-            ErrorReport.reportDdlException(ErrorCode.ERR_AUTO_INCREMENT_COLUMN_NOT_INT_DUPLICATE_TABLE);
-        }
     }
 
     /*
diff --git a/regression-test/data/data_model_p0/unique/test_unique_table_auto_inc.out b/regression-test/data/data_model_p0/unique/test_unique_table_auto_inc.out
deleted file mode 100644
index 9245ebc6b1..0000000000
--- a/regression-test/data/data_model_p0/unique/test_unique_table_auto_inc.out
+++ /dev/null
@@ -1,155 +0,0 @@
--- This file is automatically generated. You should know what you did if you want to edit this
--- !sql --
-0	Bob	100
-1	Alice	200
-2	Tom	300
-3	Test	400
-4	Carter	500
-5	Smith	600
-6	Beata	700
-7	Doris	800
-8	Nereids	900
-
--- !sql --
-0	Bob	123
-1	Alice	200
-2	Tom	323
-3	Test	400
-4	Carter	523
-5	Smith	600
-6	Beata	700
-7	Doris	800
-8	Nereids	900
-
--- !sql --
-0	Bob	100
-1	Alice	200
-2	Tom	300
-3	Test	400
-4	Carter	500
-5	Smith	600
-6	Beata	700
-7	Doris	800
-8	Nereids	900
-
--- !sql --
-1	Alice	200
-3	Test	400
-5	Smith	600
-6	Beata	700
-7	Doris	800
-8	Nereids	900
-1230	Bob	100
-1232	Tom	300
-1234	Carter	500
-
--- !sql --
-0	 Bob	100
-1	 Alice	200
-2	 Tom	300
-3	 Test	400
-4	 Carter	500
-5	 Smith	600
-6	 Beata	700
-7	 Doris	800
-8	 Nereids	900
-
--- !sql --
-0	Bob	123
-1	 Alice	200
-2	Tom	323
-3	 Test	400
-4	Carter	523
-5	 Smith	600
-6	 Beata	700
-7	 Doris	800
-8	 Nereids	900
-
--- !update_inplace --
-0	 Carter	500
-1	 Smith	600
-2	 Beata	700
-3	 Doris	800
-4	 Nereids	900
-
--- !partial_update_key --
-0	Bob	100
-1	Alice	200
-2	Tom	300
-3	Test	400
-4	Carter	500
-5	Smith	600
-6	Beata	700
-7	Doris	800
-8	Nereids	900
-
--- !partial_update_key --
-0	Bob	123
-1	Alice	200
-2	Tom	323
-3	Test	400
-4	Carter	523
-5	Smith	600
-6	Beata	723
-7	Doris	800
-8	Nereids	923
-
--- !partial_update_value --
-Bob	100	0
-Alice	200	1
-Tom	300	2
-Test	400	3
-Carter	500	4
-Smith	600	5
-Beata	700	6
-Doris	800	7
-Nereids	900	8
-
--- !partial_update_value --
-Alice	200	1
-Test	400	3
-Smith	600	5
-Doris	800	7
-Bob	100	9990
-Tom	300	9992
-Carter	500	9994
-Beata	700	9996
-Nereids	900	9998
-
--- !partial_update_value --
-Bob	100	0
-Alice	200	1
-Tom	300	2
-Test	400	3
-Carter	500	4
-Smith	600	5
-Beata	700	6
-Doris	800	7
-Nereids	900	8
-
--- !partial_update_value --
-Bob	9990	0
-Alice	200	1
-Tom	9992	2
-Test	400	3
-Carter	9994	4
-Smith	600	5
-Beata	9996	6
-Doris	800	7
-Nereids	9998	8
-
--- !sql --
-0	a
-1	b
-2	c
-
--- !sql --
-0	10
-1	20
-2	30
-
--- !sql --
-0	a	10
-1	b	20
-2	c	30
-
diff --git a/regression-test/suites/data_model_p0/unique/test_unique_table_auto_inc.groovy b/regression-test/suites/data_model_p0/unique/test_unique_table_auto_inc.groovy
deleted file mode 100644
index 84fd02f6c2..0000000000
--- a/regression-test/suites/data_model_p0/unique/test_unique_table_auto_inc.groovy
+++ /dev/null
@@ -1,346 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-suite("test_unique_table_auto_inc") {
-    
-    // auto-increment column is key
-    def table1 = "test_unique_tab_auto_inc_col_basic_key"
-    sql "drop table if exists ${table1}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table1}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table1}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-
-        file 'auto_inc_basic.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_sql "select * from ${table1};"
-    sql """ insert into ${table1} values(0, "Bob", 123), (2, "Tom", 323), (4, "Carter", 523);"""
-    qt_sql "select * from ${table1} order by id"
-    sql "drop table if exists ${table1};"
-
-    // auto-increment column is value
-    def table2 = "test_unique_tab_auto_inc_col_basic_value"
-    sql "drop table if exists ${table2}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table2}` (
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分",
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`name`, `value`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`name`, `value`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table2}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-
-        file 'auto_inc_basic.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_sql "select id, name, value from ${table2} order by id;"
-    sql """ insert into ${table2} values("Bob", 100, 1230), ("Tom", 300, 1232), ("Carter", 500, 1234);"""
-    qt_sql "select id, name, value from ${table2} order by id;"
-    sql "drop table if exists ${table2};"
-
-    // auto inc key with null values
-    def table3 = "test_unique_tab_auto_inc_col_key_with_null"
-    sql "drop table if exists ${table3}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table3}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table3}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'id, name, value'
-
-        file 'auto_inc_with_null.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_sql "select * from ${table3};"
-    sql """ insert into ${table3} values(0, "Bob", 123), (2, "Tom", 323), (4, "Carter", 523);"""
-    qt_sql "select * from ${table3} order by id"
-    sql "drop table if exists ${table3};"
-
-    // dircetly update rows in one batch
-    def table4 = "test_unique_tab_auto_inc_col_key_with_null"
-    sql "drop table if exists ${table4}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table4}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table4}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'id, name, value'
-
-        file 'auto_inc_update_inplace.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_update_inplace "select * from ${table4};"
-    sql "drop table if exists ${table4};"
-
-    // test for partial update, auto inc col is key
-    def table5 = "test_unique_tab_auto_inc_col_key_partial_update"
-    sql "drop table if exists ${table5}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table5}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table5}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-
-        file 'auto_inc_basic.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_partial_update_key "select * from ${table5} order by id;"
-
-    streamLoad {
-        table "${table5}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'id, value'
-        set 'partial_columns', 'true'
-
-        file 'auto_inc_partial_update1.csv'
-        time 10000
-    }
-    sql "sync"
-    qt_partial_update_key "select * from ${table5} order by id;"
-    sql "drop table if exists ${table5};"
-
-    // test for partial update, auto inc col is value, update auto inc col
-    def table6 = "test_unique_tab_auto_inc_col_value_partial_update"
-    sql "drop table if exists ${table6}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table6}` (
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分",
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`name`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`name`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table6}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-
-        file 'auto_inc_basic.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_partial_update_value "select * from ${table6} order by id;"
-
-    streamLoad {
-        table "${table6}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, id'
-        set 'partial_columns', 'true'
-
-        file 'auto_inc_partial_update2.csv'
-        time 10000
-    }
-    sql "sync"
-    qt_partial_update_value "select * from ${table6} order by id;"
-    sql "drop table if exists ${table6};"
-
-    // test for partial update, auto inc col is value, update other col
-    def table7 = "test_unique_tab_auto_inc_col_value_partial_update"
-    sql "drop table if exists ${table7}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table7}` (
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-          `value` int(11) NOT NULL COMMENT "用户得分",
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`name`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`name`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    streamLoad {
-        table "${table7}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-
-        file 'auto_inc_basic.csv'
-        time 10000 // limit inflight 10s
-    }
-    sql "sync"
-    qt_partial_update_value "select * from ${table7} order by id;"
-
-    streamLoad {
-        table "${table7}"
-
-        set 'column_separator', ','
-        set 'format', 'csv'
-        set 'columns', 'name, value'
-        set 'partial_columns', 'true'
-
-        file 'auto_inc_partial_update2.csv'
-        time 10000
-    }
-    sql "sync"
-    qt_partial_update_value "select * from ${table7} order by id;"
-    sql "drop table if exists ${table7};"
-
-
-    def table8 = "test_auto_inc_col_create_as_select1"
-    def table9 = "test_auto_inc_col_create_as_select2"
-    def table10 = "test_auto_inc_col_create_as_select3"
-    sql "drop table if exists ${table8}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table8}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `name` varchar(65533) NOT NULL COMMENT "用户姓名",
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    sql "drop table if exists ${table9}"
-    sql """
-        CREATE TABLE IF NOT EXISTS `${table9}` (
-          `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT "用户 ID",
-          `value` int(11) NOT NULL COMMENT "用户得分"
-        ) ENGINE=OLAP
-        UNIQUE KEY(`id`)
-        COMMENT "OLAP"
-        DISTRIBUTED BY HASH(`id`) BUCKETS 1
-        PROPERTIES (
-        "replication_allocation" = "tag.location.default: 1",
-        "in_memory" = "false",
-        "storage_format" = "V2",
-        "enable_unique_key_merge_on_write" = "true"
-        )
-    """
-    sql """insert into ${table8}(name) values("a"), ("b"), ("c"); """
-    qt_sql "select * from ${table8} order by id, name;"
-    sql """insert into ${table9}(value) values(10),(20),(30); """
-    qt_sql "select * from ${table9} order by id, value;"
-    sql "drop table if exists ${table10}"
-    sql """create table ${table10}(id,name,value) PROPERTIES("replication_num" = "1") as select A.id, A.name, B.value from ${table8} A join ${table9} B on A.id=B.id;"""
-    qt_sql "select * from ${table10} order by id, name, value;"
-    sql "drop table if exists ${table8};"
-    sql "drop table if exists ${table9};"
-    sql "drop table if exists ${table10};"
-}
-


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org