This is an automated email from the ASF dual-hosted git repository. morrysnow 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 c39c3bc0cb3 [fix](DDL) not set table type as default comment when create table (#36230) c39c3bc0cb3 is described below commit c39c3bc0cb3cee2f6fce16624330a92bb02b92b2 Author: morrySnow <101034200+morrys...@users.noreply.github.com> AuthorDate: Thu Jun 13 13:28:54 2024 +0800 [fix](DDL) not set table type as default comment when create table (#36230) pick from master #35855 --- .../main/java/org/apache/doris/catalog/Table.java | 2 +- .../test/java/org/apache/doris/alter/AlterTest.java | 2 +- .../doris/analysis/CreateTableAsSelectStmtTest.java | 21 --------------------- .../scalar_types/get_assignment_compatible_type.out | 2 +- .../show_p0/test_show_create_table_and_views.out | 10 +++++----- .../create_view_star_except_and_cast_to_sql.out | 2 +- 6 files changed, 9 insertions(+), 30 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java index 6ee10997baf..6b5de7e581f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java @@ -483,7 +483,7 @@ public abstract class Table extends MetaObject implements Writable, TableIf { } return SqlUtils.escapeQuota(comment); } - return type.name(); + return ""; } public void setComment(String comment) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/alter/AlterTest.java b/fe/fe-core/src/test/java/org/apache/doris/alter/AlterTest.java index 9eb21fb7f33..f3abe43f3f5 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/alter/AlterTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/alter/AlterTest.java @@ -351,7 +351,7 @@ public class AlterTest { // empty comment stmt = "alter table test.tbl5 modify comment ''"; alterTable(stmt, false); - Assert.assertEquals("OLAP", tbl.getComment()); + Assert.assertEquals("", tbl.getComment()); // empty column comment stmt = "alter table test.tbl5 modify column k1 comment '', modify column v1 comment 'v111'"; diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java index 6bc7d57e5dc..fa3a029c43b 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java @@ -88,7 +88,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + "DECIMAL" + "(10, 2) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -110,7 +109,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `_col0` DECIMAL(38, 2) NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`_col0`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`_col0`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -128,7 +126,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `_col0` decimal(27, 9) NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`_col0`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`_col0`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -164,7 +161,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `username` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -189,7 +185,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `_col0` BIGINT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`_col0`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`_col0`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -216,7 +211,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `_col4` BIGINT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`_col0`, `_col1`, `_col2`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`_col0`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -240,7 +234,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `amount` BIGINT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`amount`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`amount`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -260,7 +253,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `username` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`alias_name`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`alias_name`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -287,7 +279,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `status` INT NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -311,7 +302,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `status` INT NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId1`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId1`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -339,7 +329,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `userstatus` INT NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`user`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`user`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -364,7 +353,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `userId` VARCHAR(255) NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -388,7 +376,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `userId` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -408,7 +395,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `id` TINYINT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`id`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`id`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -433,7 +419,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `username` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "PARTITION BY LIST(`userId`)\n" + "(PARTITION p1 VALUES IN (\"CA\",\"GB\",\"US\",\"ZH\"))\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" @@ -461,7 +446,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " NULL DEFAULT CURRENT_TIMESTAMP\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -486,7 +470,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `username` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`username`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`username`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -512,7 +495,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `username` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "UNIQUE KEY(`userId`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`userId`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -562,7 +544,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `k2` INT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`k1`, `k2`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`k1`) BUCKETS 1\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -580,7 +561,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `k2` INT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`k1`, `k2`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`k1`) BUCKETS 1\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" @@ -612,7 +592,6 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + " `userId` VARCHAR(255) NOT NULL\n" + ") ENGINE=OLAP\n" + "DUPLICATE KEY(`_col0`)\n" - + "COMMENT 'OLAP'\n" + "DISTRIBUTED BY HASH(`_col0`) BUCKETS 10\n" + "PROPERTIES (\n" + "\"replication_allocation\" = \"tag.location.default: 1\",\n" diff --git a/regression-test/data/datatype_p0/scalar_types/get_assignment_compatible_type.out b/regression-test/data/datatype_p0/scalar_types/get_assignment_compatible_type.out index 5706a768d2d..68324f43da7 100644 --- a/regression-test/data/datatype_p0/scalar_types/get_assignment_compatible_type.out +++ b/regression-test/data/datatype_p0/scalar_types/get_assignment_compatible_type.out @@ -1,6 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !test_sql -- -test_decimal_boolean_view CREATE VIEW `test_decimal_boolean_view` COMMENT 'VIEW' AS SELECT `id` AS `id`, `c1` AS `c1`, `c2` AS `c2` FROM `default_cluster:regression_test_datatype_p0_scalar_types`.`test_decimal_boolean` WHERE 0.0 = CAST(`c1` AS DECIMALV3(2, 1)) AND CAST(`c2` AS DECIMALV3(6, 1)) = 1.0; utf8 utf8_general_ci +test_decimal_boolean_view CREATE VIEW `test_decimal_boolean_view` AS SELECT `id` AS `id`, `c1` AS `c1`, `c2` AS `c2` FROM `default_cluster:regression_test_datatype_p0_scalar_types`.`test_decimal_boolean` WHERE 0.0 = CAST(`c1` AS DECIMALV3(2, 1)) AND CAST(`c2` AS DECIMALV3(6, 1)) = 1.0; utf8 utf8_general_ci -- !test_union -- 0.0 diff --git a/regression-test/data/show_p0/test_show_create_table_and_views.out b/regression-test/data/show_p0/test_show_create_table_and_views.out index f280a24812d..804174d629a 100644 --- a/regression-test/data/show_p0/test_show_create_table_and_views.out +++ b/regression-test/data/show_p0/test_show_create_table_and_views.out @@ -1,6 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !show -- -show_create_table_and_views_table CREATE TABLE `show_create_table_and_views_table` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nCOMMENT 'OLAP'\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPAR [...] +show_create_table_and_views_table CREATE TABLE `show_create_table_and_views_table` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPARTITION p5 VALUES [...] -- !select -- 1 1 30 @@ -24,7 +24,7 @@ show_create_table_and_views_table CREATE TABLE `show_create_table_and_views_tabl 3 1 -- !show -- -show_create_table_and_views_view CREATE VIEW `show_create_table_and_views_view` COMMENT 'VIEW' AS SELECT `user_id` AS `user_id`, `cost` AS `cost` FROM `default_cluster:show_create_table_and_views_db`.`show_create_table_and_views_table` WHERE `good_id` = 2; utf8 utf8_general_ci +show_create_table_and_views_view CREATE VIEW `show_create_table_and_views_view` AS SELECT `user_id` AS `user_id`, `cost` AS `cost` FROM `default_cluster:show_create_table_and_views_db`.`show_create_table_and_views_table` WHERE `good_id` = 2; utf8 utf8_general_ci -- !select -- 1 47 @@ -36,11 +36,11 @@ show_create_table_and_views_view CREATE VIEW `show_create_table_and_views_view` 300 1 -- !show -- -show_create_table_and_views_table CREATE TABLE `show_create_table_and_views_table` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nCOMMENT 'OLAP'\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPAR [...] +show_create_table_and_views_table CREATE TABLE `show_create_table_and_views_table` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPARTITION p5 VALUES [...] -- !show -- -show_create_table_and_views_like CREATE TABLE `show_create_table_and_views_like` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nCOMMENT 'OLAP'\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPARTI [...] +show_create_table_and_views_like CREATE TABLE `show_create_table_and_views_like` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")),\nPARTITION p5 VALUES [ [...] -- !show -- -show_create_table_and_views_like_with_rollup CREATE TABLE `show_create_table_and_views_like_with_rollup` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nCOMMENT 'OLAP'\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [( [...] +show_create_table_and_views_like_with_rollup CREATE TABLE `show_create_table_and_views_like_with_rollup` (\n `user_id` LARGEINT NOT NULL,\n `good_id` LARGEINT NOT NULL,\n `cost` BIGINT SUM NULL DEFAULT "0"\n) ENGINE=OLAP\nAGGREGATE KEY(`user_id`, `good_id`)\nPARTITION BY RANGE(`good_id`)\n(PARTITION p1 VALUES [("-170141183460469231731687303715884105728"), ("100")),\nPARTITION p2 VALUES [("100"), ("200")),\nPARTITION p3 VALUES [("200"), ("300")),\nPARTITION p4 VALUES [("300"), ("400")) [...] diff --git a/regression-test/data/view_p0/create_view_star_except_and_cast_to_sql.out b/regression-test/data/view_p0/create_view_star_except_and_cast_to_sql.out index 7fc76481729..83628cb8356 100644 --- a/regression-test/data/view_p0/create_view_star_except_and_cast_to_sql.out +++ b/regression-test/data/view_p0/create_view_star_except_and_cast_to_sql.out @@ -7,5 +7,5 @@ 6 \N -- !test_sql -- -v_mal_old_create_view2 CREATE VIEW `v_mal_old_create_view2` COMMENT 'VIEW' AS SELECT CAST(CAST(`a` AS TEXT) AS TIME(0)) AS `CAST(CAST(``a`` AS TEXT) AS TIME(0))` FROM `default_cluster:regression_test_view_p0`.`mal_old_create_view`; utf8 utf8_general_ci +v_mal_old_create_view2 CREATE VIEW `v_mal_old_create_view2` AS SELECT CAST(CAST(`a` AS TEXT) AS TIME(0)) AS `CAST(CAST(``a`` AS TEXT) AS TIME(0))` FROM `default_cluster:regression_test_view_p0`.`mal_old_create_view`; utf8 utf8_general_ci --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org