This is an automated email from the ASF dual-hosted git repository. zykkk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 0aa00026bb [fix](autoinc) ignore column property isAutoInc() for create table as select ... statement(#22827) 0aa00026bb is described below commit 0aa00026bb7563a40e4d056c368500940adb2945 Author: bobhan1 <bh2444151...@outlook.com> AuthorDate: Thu Aug 10 23:25:54 2023 +0800 [fix](autoinc) ignore column property isAutoInc() for create table as select ... statement(#22827) --- .../apache/doris/datasource/InternalCatalog.java | 2 +- .../unique/test_unique_table_auto_inc.out | 15 +++++++ .../unique/test_unique_table_auto_inc.groovy | 47 ++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) 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 4a617ebfb3..0b5fc6e086 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 @@ -1258,7 +1258,7 @@ public class InternalCatalog implements CatalogIf<Database> { defaultValue = new DefaultValue(setDefault, column.getDefaultValue()); } columnDef = new ColumnDef(name, typeDef, false, null, - column.isAllowNull(), column.isAutoInc(), defaultValue, column.getComment()); + column.isAllowNull(), false, defaultValue, column.getComment()); } createTableStmt.addColumnDef(columnDef); // set first column as default distribution 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 index 6409ff1958..9245ebc6b1 100644 --- 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 @@ -138,3 +138,18 @@ 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 index a277114f1b..84fd02f6c2 100644 --- 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 @@ -295,5 +295,52 @@ suite("test_unique_table_auto_inc") { 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-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org