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

yiguolei 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 efebb3d21e [fix](schema) fix show create table get wrong random 
distribution info (#18895)
efebb3d21e is described below

commit efebb3d21ef809dacdf7bdeb7c76efad063eedb2
Author: xueweizhang <zxw520bl...@163.com>
AuthorDate: Mon Apr 24 23:33:42 2023 +0800

    [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 <zxw520bl...@163.com>
---
 .../apache/doris/catalog/RandomDistributionInfo.java   |  4 ++--
 .../data/query_p0/show/test_show_create_table.out      |  3 +++
 .../suites/query_p0/show/test_show_create_table.groovy | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
index 31371e7799..3c63546ffc 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/RandomDistributionInfo.java
@@ -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();
     }
diff --git a/regression-test/data/query_p0/show/test_show_create_table.out 
b/regression-test/data/query_p0/show/test_show_create_table.out
index 402acb3133..7dd2f8307e 100644
--- a/regression-test/data/query_p0/show/test_show_create_table.out
+++ b/regression-test/data/query_p0/show/test_show_create_table.out
@@ -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`, `datet [...]
 
+-- !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 [...]
+
diff --git a/regression-test/suites/query_p0/show/test_show_create_table.groovy 
b/regression-test/suites/query_p0/show/test_show_create_table.groovy
index e2c81ce67e..5b1643d130 100644
--- a/regression-test/suites/query_p0/show/test_show_create_table.groovy
+++ b/regression-test/suites/query_p0/show/test_show_create_table.groovy
@@ -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}`")


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

Reply via email to