[fix](schema) fix show create table get wrong random distribution info (#18895)
* [fix](schema) fix show create table get wrong random distribution info --------- Signed-off-by: nextdreamblue <zxw520blue1@163.com>
This commit is contained in:
@ -56,9 +56,9 @@ public class RandomDistributionInfo extends DistributionInfo {
|
||||
public String toSql() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (autoBucket) {
|
||||
builder.append("DISTRIBUTED BY RANDOM() BUCKETS AUTO");
|
||||
builder.append("DISTRIBUTED BY RANDOM BUCKETS AUTO");
|
||||
} else {
|
||||
builder.append("DISTRIBUTED BY RANDOM() BUCKETS ").append(bucketNum);
|
||||
builder.append("DISTRIBUTED BY RANDOM BUCKETS ").append(bucketNum);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@ -2,3 +2,6 @@
|
||||
-- !select --
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime NULL COMMENT 'c',\n `datetimek3` datetime NULL COMMENT 'd',\n `datev1` date MAX NOT NULL COMMENT 'e',\n `datetimev1` datetime MAX NOT NULL COMMENT 'f',\n `datetimev2` datetime MAX NOT NULL COMMENT 'g',\n `datetimev3` datetime MAX NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nAGGREGATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`datek1`) BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false"\n);
|
||||
|
||||
-- !select --
|
||||
tb_show_create_table CREATE TABLE `tb_show_create_table` (\n `datek1` date NULL COMMENT 'a',\n `datetimek1` datetime NULL COMMENT 'b',\n `datetimek2` datetime NULL COMMENT 'c',\n `datetimek3` datetime NULL COMMENT 'd',\n `datev1` date NOT NULL COMMENT 'e',\n `datetimev1` datetime NOT NULL COMMENT 'f',\n `datetimev2` datetime NOT NULL COMMENT 'g',\n `datetimev3` datetime NOT NULL COMMENT 'h'\n) ENGINE=OLAP\nDUPLICATE KEY(`datek1`, `datetimek1`, `datetimek2`, `datetimek3`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY RANDOM BUCKETS 5\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"in_memory" = "false",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false"\n);
|
||||
|
||||
|
||||
@ -36,6 +36,24 @@ suite("test_show_create_table", "query") {
|
||||
|
||||
qt_select "show create table `${tb_name}`"
|
||||
|
||||
sql """drop table if exists ${tb_name} """
|
||||
sql """
|
||||
CREATE TABLE IF NOT EXISTS ${tb_name}(
|
||||
datek1 datev2 COMMENT "a",
|
||||
datetimek1 datetimev2 COMMENT "b",
|
||||
datetimek2 datetimev2(3) COMMENT "c",
|
||||
datetimek3 datetimev2(6) COMMENT "d",
|
||||
datev1 datev2 NOT NULL COMMENT "e",
|
||||
datetimev1 datetimev2 NOT NULL COMMENT "f",
|
||||
datetimev2 datetimev2(3) NOT NULL COMMENT "g",
|
||||
datetimev3 datetimev2(6) NOT NULL COMMENT "h"
|
||||
)
|
||||
DUPLICATE KEY (datek1, datetimek1, datetimek2, datetimek3)
|
||||
DISTRIBUTED BY RANDOM BUCKETS 5 properties("replication_num" = "1");
|
||||
"""
|
||||
|
||||
qt_select "show create table `${tb_name}`"
|
||||
|
||||
} finally {
|
||||
|
||||
try_sql("DROP TABLE IF EXISTS `${tb_name}`")
|
||||
|
||||
Reference in New Issue
Block a user