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 8a4a92f658 [Enchancement](compatible) show dateV2/datetimeV2 to 
date/datetime  (#18358)
8a4a92f658 is described below

commit 8a4a92f65862ba3498583a6ae48fef665bb08f60
Author: WenYao <[email protected]>
AuthorDate: Sun Apr 9 10:34:14 2023 +0800

    [Enchancement](compatible) show dateV2/datetimeV2 to date/datetime  (#18358)
    
    show dateV2/datetimeV2 to date/datetime
    
    modify show create table
    modify desc table
    use desc table all to get real type from column ColumnType
---
 .../org/apache/doris/analysis/DescribeStmt.java    | 13 +++++
 .../main/java/org/apache/doris/catalog/Column.java | 20 +++++++-
 .../main/java/org/apache/doris/catalog/Env.java    |  3 +-
 .../doris/common/proc/IndexSchemaProcNode.java     |  7 +++
 .../test_create_table_with_bloom_filter.out        | 32 ++++++------
 .../aggregate/test_aggregate_table.out             | 32 ++++++------
 .../duplicate/test_duplicate_table.out             |  8 +--
 .../data/index_p0/test_bitmap_index.out            | 24 ++++-----
 .../data/query_p0/show/test_show_create_table.out  |  4 ++
 .../data/rollup/test_materialized_view_hll.out     | 16 +++---
 .../test_materialized_view_hll_with_light_sc.out   | 16 +++---
 .../data/rollup_p0/test_materialized_view.out      | 60 +++++++++++-----------
 regression-test/data/rollup_p0/test_rollup_agg.out | 20 ++++----
 .../data/rollup_p0/test_rollup_agg_date.out        | 36 ++++++-------
 .../query_p0/show/test_show_create_table.groovy    | 44 ++++++++++++++++
 15 files changed, 210 insertions(+), 125 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
index c9e6c9791c..b94fe15d96 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
@@ -67,6 +67,7 @@ public class DescribeStmt extends ShowStmt {
                     .addColumn(new Column("IndexKeysType", 
ScalarType.createVarchar(20)))
                     .addColumn(new Column("Field", 
ScalarType.createVarchar(20)))
                     .addColumn(new Column("Type", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("InternalType", 
ScalarType.createVarchar(20)))
                     .addColumn(new Column("Null", 
ScalarType.createVarchar(10)))
                     .addColumn(new Column("Key", ScalarType.createVarchar(10)))
                     .addColumn(new Column("Default", 
ScalarType.createVarchar(30)))
@@ -130,6 +131,11 @@ public class DescribeStmt extends ShowStmt {
                                 ? FeConstants.null_string : 
column.getDefaultValue(),
                         "NONE"
                 );
+                if (column.getOriginType().isDatetimeV2()) {
+                    row.set(1, "DATETIME");
+                } else if (column.getOriginType().isDateV2()) {
+                    row.set(1, "DATE");
+                }
                 totalRows.add(row);
             }
             return;
@@ -205,6 +211,7 @@ public class DescribeStmt extends ShowStmt {
                                     "",
                                     column.getName(),
                                     column.getOriginType().toString(),
+                                    column.getOriginType().toString(),
                                     column.isAllowNull() ? "Yes" : "No",
                                     ((Boolean) column.isKey()).toString(),
                                     column.getDefaultValue() == null
@@ -215,6 +222,12 @@ public class DescribeStmt extends ShowStmt {
                                     column.getDefineExpr() == null ? "" : 
column.getDefineExpr().toSql(),
                                     "");
 
+                            if (column.getOriginType().isDatetimeV2()) {
+                                row.set(3, "DATETIME");
+                            } else if (column.getOriginType().isDateV2()) {
+                                row.set(3, "DATE");
+                            }
+
                             if (j == 0) {
                                 row.set(0, indexName);
                                 row.set(1, indexMeta.getKeysType().name());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
index 790d16e7f0..88f8fc279f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
@@ -633,14 +633,30 @@ public class Column implements Writable, 
GsonPostProcessable {
     }
 
     public String toSql() {
-        return toSql(false);
+        return toSql(false, false);
     }
 
     public String toSql(boolean isUniqueTable) {
+        return toSql(isUniqueTable, false);
+    }
+
+    public String toSql(boolean isUniqueTable, boolean isCompatible) {
         StringBuilder sb = new StringBuilder();
         sb.append("`").append(name).append("` ");
         String typeStr = type.toSql();
-        sb.append(typeStr);
+
+        // show change datetimeV2/dateV2 to datetime/date
+        if (isCompatible) {
+            if (type.isDatetimeV2()) {
+                sb.append("datetime");
+            } else if (type.isDateV2()) {
+                sb.append("date");
+            } else {
+                sb.append(typeStr);
+            }
+        } else {
+            sb.append(typeStr);
+        }
         if (aggregationType != null && aggregationType != AggregateType.NONE 
&& !isUniqueTable
                 && !isAggregationTypeImplicit) {
             sb.append(" ").append(aggregationType.name());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index d753af373a..af1aa6b4bf 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -2789,7 +2789,8 @@ public class Env {
                 // There MUST BE 2 space in front of each column description 
line
                 // sqlalchemy requires this to parse SHOW CREATE TABLE stmt.
                 if (table.getType() == TableType.OLAP) {
-                    sb.append("  ").append(column.toSql(((OlapTable) 
table).getKeysType() == KeysType.UNIQUE_KEYS));
+                    sb.append("  ").append(
+                            column.toSql(((OlapTable) table).getKeysType() == 
KeysType.UNIQUE_KEYS, true));
                 } else {
                     sb.append("  ").append(column.toSql());
                 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/IndexSchemaProcNode.java
 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/IndexSchemaProcNode.java
index b6b92f9f89..5824ff3665 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/IndexSchemaProcNode.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/IndexSchemaProcNode.java
@@ -73,6 +73,13 @@ public class IndexSchemaProcNode implements 
ProcNodeInterface {
                                                  column.getDefaultValue() == 
null
                                                          ? 
FeConstants.null_string : column.getDefaultValue(),
                                                  extraStr);
+
+            if (column.getOriginType().isDateV2()) {
+                rowList.set(1, "DATE");
+            }
+            if (column.getOriginType().isDatetimeV2()) {
+                rowList.set(1, "DATETIME");
+            }
             result.addRow(rowList);
         }
         return result;
diff --git 
a/regression-test/data/bloom_filter_p0/test_create_table_with_bloom_filter.out 
b/regression-test/data/bloom_filter_p0/test_create_table_with_bloom_filter.out
index 9d60ceb467..8e222a3825 100644
--- 
a/regression-test/data/bloom_filter_p0/test_create_table_with_bloom_filter.out
+++ 
b/regression-test/data/bloom_filter_p0/test_create_table_with_bloom_filter.out
@@ -18,10 +18,10 @@ decimal64_key       DECIMALV3(14, 1)        No      true    
\N      BLOOM_FILTER
 decimal128_key DECIMALV3(38, 1)        No      true    \N      BLOOM_FILTER
 date_key       DATE    No      true    \N      BLOOM_FILTER
 datetime_key   DATETIME        No      true    \N      BLOOM_FILTER
-datev2_key     DATEV2  No      true    \N      BLOOM_FILTER
-datetimev2_key_1       DATETIMEV2(0)   No      true    \N      BLOOM_FILTER
-datetimev2_key_2       DATETIMEV2(3)   No      true    \N      BLOOM_FILTER
-datetimev2_key_3       DATETIMEV2(6)   No      true    \N      BLOOM_FILTER
+datev2_key     DATE    No      true    \N      BLOOM_FILTER
+datetimev2_key_1       DATETIME        No      true    \N      BLOOM_FILTER
+datetimev2_key_2       DATETIME        No      true    \N      BLOOM_FILTER
+datetimev2_key_3       DATETIME        No      true    \N      BLOOM_FILTER
 tinyint_value  TINYINT No      false   \N      SUM
 smallint_value SMALLINT        No      false   \N      SUM
 int_value      INT     No      false   \N      SUM
@@ -41,18 +41,18 @@ date_value_min      DATE    No      false   \N      MIN
 datetime_value_max     DATETIME        No      false   \N      MAX
 datetime_value_replace DATETIME        No      false   \N      REPLACE
 datetime_value_min     DATETIME        No      false   \N      MIN
-datev2_value_max       DATEV2  No      false   \N      MAX
-datev2_value_replace   DATEV2  No      false   \N      REPLACE
-datev2_value_min       DATEV2  No      false   \N      MIN
-datetimev2_value_1_max DATETIMEV2(0)   No      false   \N      MAX
-datetimev2_value_1_replace     DATETIMEV2(0)   No      false   \N      REPLACE
-datetimev2_value_1_min DATETIMEV2(0)   No      false   \N      MIN
-datetimev2_value_2_max DATETIMEV2(3)   No      false   \N      MAX
-datetimev2_value_2_replace     DATETIMEV2(3)   No      false   \N      REPLACE
-datetimev2_value_2_min DATETIMEV2(3)   No      false   \N      MIN
-datetimev2_value_3_max DATETIMEV2(6)   No      false   \N      MAX
-datetimev2_value_3_replace     DATETIMEV2(6)   No      false   \N      REPLACE
-datetimev2_value_3_min DATETIMEV2(6)   No      false   \N      MIN
+datev2_value_max       DATE    No      false   \N      MAX
+datev2_value_replace   DATE    No      false   \N      REPLACE
+datev2_value_min       DATE    No      false   \N      MIN
+datetimev2_value_1_max DATETIME        No      false   \N      MAX
+datetimev2_value_1_replace     DATETIME        No      false   \N      REPLACE
+datetimev2_value_1_min DATETIME        No      false   \N      MIN
+datetimev2_value_2_max DATETIME        No      false   \N      MAX
+datetimev2_value_2_replace     DATETIME        No      false   \N      REPLACE
+datetimev2_value_2_min DATETIME        No      false   \N      MIN
+datetimev2_value_3_max DATETIME        No      false   \N      MAX
+datetimev2_value_3_replace     DATETIME        No      false   \N      REPLACE
+datetimev2_value_3_min DATETIME        No      false   \N      MIN
 float_value    FLOAT   No      false   \N      SUM
 double_value   DOUBLE  No      false   \N      SUM
 
diff --git 
a/regression-test/data/data_model_p0/aggregate/test_aggregate_table.out 
b/regression-test/data/data_model_p0/aggregate/test_aggregate_table.out
index a452023ffb..eac6262f1d 100644
--- a/regression-test/data/data_model_p0/aggregate/test_aggregate_table.out
+++ b/regression-test/data/data_model_p0/aggregate/test_aggregate_table.out
@@ -29,20 +29,20 @@ date_value_max      DATE    Yes     false   \N      MAX
 date_value_min DATE    Yes     false   \N      MIN
 date_value_replace     DATE    Yes     false   \N      REPLACE
 date_value_replace_if_not_null DATE    Yes     false   \N      
REPLACE_IF_NOT_NULL
-datev2_value_max       DATEV2  Yes     false   \N      MAX
-datev2_value_min       DATEV2  Yes     false   \N      MIN
-datev2_value_replace   DATEV2  Yes     false   \N      REPLACE
-datev2_value_replace_if_not_null       DATEV2  Yes     false   \N      
REPLACE_IF_NOT_NULL
-datetimev2_value_max   DATETIMEV2(0)   Yes     false   \N      MAX
-datetimev2_value_min   DATETIMEV2(0)   Yes     false   \N      MIN
-datetimev2_value_replace       DATETIMEV2(0)   Yes     false   \N      REPLACE
-datetimev2_value_replace_if_not_null   DATETIMEV2(0)   Yes     false   \N      
REPLACE_IF_NOT_NULL
-datetimev2_value_max_1 DATETIMEV2(3)   Yes     false   \N      MAX
-datetimev2_value_min_1 DATETIMEV2(3)   Yes     false   \N      MIN
-datetimev2_value_replace_1     DATETIMEV2(3)   Yes     false   \N      REPLACE
-datetimev2_value_replace_if_not_null_1 DATETIMEV2(3)   Yes     false   \N      
REPLACE_IF_NOT_NULL
-datetimev2_value_max_2 DATETIMEV2(6)   Yes     false   \N      MAX
-datetimev2_value_min_2 DATETIMEV2(6)   Yes     false   \N      MIN
-datetimev2_value_replace_2     DATETIMEV2(6)   Yes     false   \N      REPLACE
-datetimev2_value_replace_if_not_null_2 DATETIMEV2(6)   Yes     false   \N      
REPLACE_IF_NOT_NULL
+datev2_value_max       DATE    Yes     false   \N      MAX
+datev2_value_min       DATE    Yes     false   \N      MIN
+datev2_value_replace   DATE    Yes     false   \N      REPLACE
+datev2_value_replace_if_not_null       DATE    Yes     false   \N      
REPLACE_IF_NOT_NULL
+datetimev2_value_max   DATETIME        Yes     false   \N      MAX
+datetimev2_value_min   DATETIME        Yes     false   \N      MIN
+datetimev2_value_replace       DATETIME        Yes     false   \N      REPLACE
+datetimev2_value_replace_if_not_null   DATETIME        Yes     false   \N      
REPLACE_IF_NOT_NULL
+datetimev2_value_max_1 DATETIME        Yes     false   \N      MAX
+datetimev2_value_min_1 DATETIME        Yes     false   \N      MIN
+datetimev2_value_replace_1     DATETIME        Yes     false   \N      REPLACE
+datetimev2_value_replace_if_not_null_1 DATETIME        Yes     false   \N      
REPLACE_IF_NOT_NULL
+datetimev2_value_max_2 DATETIME        Yes     false   \N      MAX
+datetimev2_value_min_2 DATETIME        Yes     false   \N      MIN
+datetimev2_value_replace_2     DATETIME        Yes     false   \N      REPLACE
+datetimev2_value_replace_if_not_null_2 DATETIME        Yes     false   \N      
REPLACE_IF_NOT_NULL
 
diff --git 
a/regression-test/data/data_model_p0/duplicate/test_duplicate_table.out 
b/regression-test/data/data_model_p0/duplicate/test_duplicate_table.out
index 53ca0ae627..59973fcdd7 100644
--- a/regression-test/data/data_model_p0/duplicate/test_duplicate_table.out
+++ b/regression-test/data/data_model_p0/duplicate/test_duplicate_table.out
@@ -9,10 +9,10 @@ k     INT     Yes     true    \N
 int_value      INT     Yes     false   \N      NONE
 char_value     CHAR(10)        Yes     false   \N      NONE
 date_value     DATE    Yes     false   \N      NONE
-date_value2    DATEV2  Yes     false   \N      NONE
-date_value3    DATETIMEV2(0)   Yes     false   \N      NONE
-date_value4    DATETIMEV2(3)   Yes     false   \N      NONE
-date_value5    DATETIMEV2(6)   Yes     false   \N      NONE
+date_value2    DATE    Yes     false   \N      NONE
+date_value3    DATETIME        Yes     false   \N      NONE
+date_value4    DATETIME        Yes     false   \N      NONE
+date_value5    DATETIME        Yes     false   \N      NONE
 
 -- !select_dup_table --
 0      1       2       3
diff --git a/regression-test/data/index_p0/test_bitmap_index.out 
b/regression-test/data/index_p0/test_bitmap_index.out
index 8b6081fc7a..5eb7f08b93 100644
--- a/regression-test/data/index_p0/test_bitmap_index.out
+++ b/regression-test/data/index_p0/test_bitmap_index.out
@@ -11,10 +11,10 @@ k8  DATETIME        Yes     false   \N      NONE
 k9     LARGEINT        Yes     false   \N      NONE
 k10    DECIMAL(9, 0)   Yes     false   \N      NONE
 k11    BOOLEAN Yes     false   \N      NONE
-k12    DATEV2  Yes     false   \N      NONE
-k13    DATETIMEV2(0)   Yes     false   \N      NONE
-k14    DATETIMEV2(3)   Yes     false   \N      NONE
-k15    DATETIMEV2(6)   Yes     false   \N      NONE
+k12    DATE    Yes     false   \N      NONE
+k13    DATETIME        Yes     false   \N      NONE
+k14    DATETIME        Yes     false   \N      NONE
+k15    DATETIME        Yes     false   \N      NONE
 
 -- !sql --
 default_cluster:regression_test_index_p0.test_bitmap_index_dup         index1  
        k1                                              BITMAP          
@@ -48,10 +48,10 @@ k8  DATETIME        Yes     true    \N
 k9     LARGEINT        Yes     true    \N      
 k10    DECIMAL(9, 0)   Yes     true    \N      
 k11    BOOLEAN Yes     true    \N      
-k12    DATEV2  Yes     true    \N      
-k13    DATETIMEV2(0)   Yes     true    \N      
-k14    DATETIMEV2(3)   Yes     true    \N      
-k15    DATETIMEV2(6)   Yes     true    \N      
+k12    DATE    Yes     true    \N      
+k13    DATETIME        Yes     true    \N      
+k14    DATETIME        Yes     true    \N      
+k15    DATETIME        Yes     true    \N      
 v1     INT     Yes     false   \N      SUM
 
 -- !sql --
@@ -86,10 +86,10 @@ k8  DATETIME        Yes     true    \N
 k9     LARGEINT        Yes     true    \N      
 k10    DECIMAL(9, 0)   Yes     true    \N      
 k11    BOOLEAN Yes     true    \N      
-k12    DATEV2  Yes     false   \N      REPLACE
-k13    DATETIMEV2(0)   Yes     false   \N      REPLACE
-k14    DATETIMEV2(3)   Yes     false   \N      REPLACE
-k15    DATETIMEV2(6)   Yes     false   \N      REPLACE
+k12    DATE    Yes     false   \N      REPLACE
+k13    DATETIME        Yes     false   \N      REPLACE
+k14    DATETIME        Yes     false   \N      REPLACE
+k15    DATETIME        Yes     false   \N      REPLACE
 v1     INT     Yes     false   \N      REPLACE
 
 -- !sql --
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
new file mode 100644
index 0000000000..cc64b17c40
--- /dev/null
+++ b/regression-test/data/query_p0/show/test_show_create_table.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !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 [...]
+
diff --git a/regression-test/data/rollup/test_materialized_view_hll.out 
b/regression-test/data/rollup/test_materialized_view_hll.out
index 26dbbea0ec..3924908a1e 100644
--- a/regression-test/data/rollup/test_materialized_view_hll.out
+++ b/regression-test/data/rollup/test_materialized_view_hll.out
@@ -1,13 +1,13 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql --
-test_materialized_view_hll     DUP_KEYS        record_id       INT     Yes     
true    \N              true            
-               seller_id       INT     Yes     true    \N              true    
        
-               store_id        INT     Yes     true    \N              true    
        
-               sale_date       DATE    Yes     false   \N      NONE    true    
        
-               sale_amt        BIGINT  Yes     false   \N      NONE    true    
        
-                                                                               
-amt_count      AGG_KEYS        mv_store_id     INT     Yes     true    \N      
        true    `store_id`      
-               mva_HLL_UNION__hll_hash(`sale_amt`)     HLL     No      false   
\N      HLL_UNION       true    hll_hash(`sale_amt`)    
+test_materialized_view_hll     DUP_KEYS        record_id       INT     INT     
Yes     true    \N              true            
+               seller_id       INT     INT     Yes     true    \N              
true            
+               store_id        INT     INT     Yes     true    \N              
true            
+               sale_date       DATE    DATE    Yes     false   \N      NONE    
true            
+               sale_amt        BIGINT  BIGINT  Yes     false   \N      NONE    
true            
+                                                                               
        
+amt_count      AGG_KEYS        mv_store_id     INT     INT     Yes     true    
\N              true    `store_id`      
+               mva_HLL_UNION__hll_hash(`sale_amt`)     HLL     HLL     No      
false   \N      HLL_UNION       true    hll_hash(`sale_amt`)    
 
 -- !sql --
 1      1
diff --git 
a/regression-test/data/rollup/test_materialized_view_hll_with_light_sc.out 
b/regression-test/data/rollup/test_materialized_view_hll_with_light_sc.out
index 84e4aaa630..0303db0d3e 100644
--- a/regression-test/data/rollup/test_materialized_view_hll_with_light_sc.out
+++ b/regression-test/data/rollup/test_materialized_view_hll_with_light_sc.out
@@ -1,13 +1,13 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql --
-test_materialized_view_hll_with_light_sc       DUP_KEYS        record_id       
INT     Yes     true    \N              true            
-               seller_id       INT     Yes     true    \N              true    
        
-               store_id        INT     Yes     true    \N              true    
        
-               sale_date       DATE    Yes     false   \N      NONE    true    
        
-               sale_amt        BIGINT  Yes     false   \N      NONE    true    
        
-                                                                               
-amt_count1     AGG_KEYS        mv_store_id     INT     Yes     true    \N      
        true    `store_id`      
-               mva_HLL_UNION__hll_hash(`sale_amt`)     HLL     No      false   
\N      HLL_UNION       true    hll_hash(`sale_amt`)    
+test_materialized_view_hll_with_light_sc       DUP_KEYS        record_id       
INT     INT     Yes     true    \N              true            
+               seller_id       INT     INT     Yes     true    \N              
true            
+               store_id        INT     INT     Yes     true    \N              
true            
+               sale_date       DATE    DATE    Yes     false   \N      NONE    
true            
+               sale_amt        BIGINT  BIGINT  Yes     false   \N      NONE    
true            
+                                                                               
        
+amt_count1     AGG_KEYS        mv_store_id     INT     INT     Yes     true    
\N              true    `store_id`      
+               mva_HLL_UNION__hll_hash(`sale_amt`)     HLL     HLL     No      
false   \N      HLL_UNION       true    hll_hash(`sale_amt`)    
 
 -- !sql --
 1      1
diff --git a/regression-test/data/rollup_p0/test_materialized_view.out 
b/regression-test/data/rollup_p0/test_materialized_view.out
index 7a5174bb6f..0806c2f7f1 100644
--- a/regression-test/data/rollup_p0/test_materialized_view.out
+++ b/regression-test/data/rollup_p0/test_materialized_view.out
@@ -1,24 +1,24 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql --
-test_materialized_view1        DUP_KEYS        record_id       INT     Yes     
true    \N              true            
-               seller_id       INT     Yes     true    \N              true    
        
-               store_id        INT     Yes     true    \N              true    
        
-               sale_date       DATE    Yes     false   \N      NONE    true    
        
-               sale_amt        BIGINT  Yes     false   \N      NONE    true    
        
-                                                                               
-amt_sum        AGG_KEYS        mv_store_id     INT     Yes     true    \N      
        true    `store_id`      
-               mva_SUM__`sale_amt`     BIGINT  Yes     false   \N      SUM     
true    `sale_amt`      
-
--- !sql --
-test_materialized_view2        DUP_KEYS        record_id       INT     Yes     
true    \N              true            
-               seller_id       INT     Yes     true    \N              true    
        
-               store_id        INT     Yes     true    \N              true    
        
-               sale_date       DATE    Yes     false   \N      NONE    true    
        
-               sale_amt        BIGINT  Yes     false   \N      NONE    true    
        
-                                                                               
-seller_id_order        DUP_KEYS        mv_store_id     INT     Yes     true    
\N              true    `store_id`      
-               mv_seller_id    INT     Yes     true    \N              true    
`seller_id`     
-               mv_sale_amt     BIGINT  Yes     false   \N      NONE    true    
`sale_amt`      
+test_materialized_view1        DUP_KEYS        record_id       INT     INT     
Yes     true    \N              true            
+               seller_id       INT     INT     Yes     true    \N              
true            
+               store_id        INT     INT     Yes     true    \N              
true            
+               sale_date       DATE    DATE    Yes     false   \N      NONE    
true            
+               sale_amt        BIGINT  BIGINT  Yes     false   \N      NONE    
true            
+                                                                               
        
+amt_sum        AGG_KEYS        mv_store_id     INT     INT     Yes     true    
\N              true    `store_id`      
+               mva_SUM__`sale_amt`     BIGINT  BIGINT  Yes     false   \N      
SUM     true    `sale_amt`      
+
+-- !sql --
+test_materialized_view2        DUP_KEYS        record_id       INT     INT     
Yes     true    \N              true            
+               seller_id       INT     INT     Yes     true    \N              
true            
+               store_id        INT     INT     Yes     true    \N              
true            
+               sale_date       DATE    DATE    Yes     false   \N      NONE    
true            
+               sale_amt        BIGINT  BIGINT  Yes     false   \N      NONE    
true            
+                                                                               
        
+seller_id_order        DUP_KEYS        mv_store_id     INT     INT     Yes     
true    \N              true    `store_id`      
+               mv_seller_id    INT     INT     Yes     true    \N              
true    `seller_id`     
+               mv_sale_amt     BIGINT  BIGINT  Yes     false   \N      NONE    
true    `sale_amt`      
 
 -- !sql --
 1      1       1       2020-05-30      100
@@ -35,17 +35,17 @@ seller_id_order     DUP_KEYS        mv_store_id     INT     
Yes     true    \N              true    `store_id`
 1      200
 
 -- !sql --
-                                                                               
-                                                                               
-               mva_SUM__CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END BIGINT  
No      false   \N      SUM     true    CASE WHEN `sale_amt` IS NULL THEN 0 
ELSE 1 END  
-               mva_SUM__`sale_amt`     BIGINT  Yes     false   \N      SUM     
true    `sale_amt`      
-               sale_amt        BIGINT  Yes     false   \N      NONE    true    
        
-               sale_date       DATE    Yes     false   \N      NONE    true    
        
-               seller_id       INT     Yes     true    \N              true    
        
-               store_id        INT     Yes     true    \N              true    
        
-amt_count      AGG_KEYS        mv_store_id     INT     Yes     true    \N      
        true    `store_id`      
-amt_sum        AGG_KEYS        mv_store_id     INT     Yes     true    \N      
        true    `store_id`      
-test_materialized_view1        DUP_KEYS        record_id       INT     Yes     
true    \N              true            
+                                                                               
        
+                                                                               
        
+               mva_SUM__CASE WHEN `sale_amt` IS NULL THEN 0 ELSE 1 END BIGINT  
BIGINT  No      false   \N      SUM     true    CASE WHEN `sale_amt` IS NULL 
THEN 0 ELSE 1 END  
+               mva_SUM__`sale_amt`     BIGINT  BIGINT  Yes     false   \N      
SUM     true    `sale_amt`      
+               sale_amt        BIGINT  BIGINT  Yes     false   \N      NONE    
true            
+               sale_date       DATE    DATE    Yes     false   \N      NONE    
true            
+               seller_id       INT     INT     Yes     true    \N              
true            
+               store_id        INT     INT     Yes     true    \N              
true            
+amt_count      AGG_KEYS        mv_store_id     INT     INT     Yes     true    
\N              true    `store_id`      
+amt_sum        AGG_KEYS        mv_store_id     INT     INT     Yes     true    
\N              true    `store_id`      
+test_materialized_view1        DUP_KEYS        record_id       INT     INT     
Yes     true    \N              true            
 
 -- !sql --
 1      2
diff --git a/regression-test/data/rollup_p0/test_rollup_agg.out 
b/regression-test/data/rollup_p0/test_rollup_agg.out
index d416e8990b..8cdb01eb75 100644
--- a/regression-test/data/rollup_p0/test_rollup_agg.out
+++ b/regression-test/data/rollup_p0/test_rollup_agg.out
@@ -1,15 +1,15 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql --
-test_rollup_agg        AGG_KEYS        siteid  INT     No      true    \N      
        true            
-               citycode        SMALLINT        No      true    \N              
true            
-               username        VARCHAR(32)     No      true    \N              
true            
-               pv      BIGINT  No      false   0       SUM     true            
-               uv      BIGINT  No      false   0       SUM     true            
-               vv      BIGINT  Yes     false   0       SUM     true            
-                                                                               
-rollup_city    AGG_KEYS        citycode        SMALLINT        No      true    
\N              true            
-               pv      BIGINT  No      false   0       SUM     true            
-               vv      BIGINT  Yes     false   0       SUM     true            
+test_rollup_agg        AGG_KEYS        siteid  INT     INT     No      true    
\N              true            
+               citycode        SMALLINT        SMALLINT        No      true    
\N              true            
+               username        VARCHAR(32)     VARCHAR(32)     No      true    
\N              true            
+               pv      BIGINT  BIGINT  No      false   0       SUM     true    
        
+               uv      BIGINT  BIGINT  No      false   0       SUM     true    
        
+               vv      BIGINT  BIGINT  Yes     false   0       SUM     true    
        
+                                                                               
        
+rollup_city    AGG_KEYS        citycode        SMALLINT        SMALLINT        
No      true    \N              true            
+               pv      BIGINT  BIGINT  No      false   0       SUM     true    
        
+               vv      BIGINT  BIGINT  Yes     false   0       SUM     true    
        
 
 -- !sql --
 1      200
diff --git a/regression-test/data/rollup_p0/test_rollup_agg_date.out 
b/regression-test/data/rollup_p0/test_rollup_agg_date.out
index 58b2568e5e..d29e074290 100644
--- a/regression-test/data/rollup_p0/test_rollup_agg_date.out
+++ b/regression-test/data/rollup_p0/test_rollup_agg_date.out
@@ -1,23 +1,23 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql --
-test_rollup_agg_date   AGG_KEYS        datek1  DATEV2  Yes     true    \N      
        true            
-               datetimek1      DATETIMEV2(0)   Yes     true    \N              
true            
-               datetimek2      DATETIMEV2(3)   Yes     true    \N              
true            
-               datetimek3      DATETIMEV2(6)   Yes     true    \N              
true            
-               datev1  DATEV2  No      false   \N      MAX     true            
-               datetimev1      DATETIMEV2(0)   No      false   \N      MAX     
true            
-               datetimev2      DATETIMEV2(3)   No      false   \N      MAX     
true            
-               datetimev3      DATETIMEV2(6)   No      false   \N      MAX     
true            
-               datetimev4      DATETIMEV2(3)   Yes     false   \N      MAX     
true            
-                                                                               
-rollup_date    AGG_KEYS        datek1  DATEV2  Yes     true    \N              
true            
-               datetimek2      DATETIMEV2(3)   Yes     true    \N              
true            
-               datetimek1      DATETIMEV2(0)   Yes     true    \N              
true            
-               datetimek3      DATETIMEV2(6)   Yes     true    \N              
true            
-               datev1  DATEV2  No      false   \N      MAX     true            
-               datetimev1      DATETIMEV2(0)   No      false   \N      MAX     
true            
-               datetimev2      DATETIMEV2(3)   No      false   \N      MAX     
true            
-               datetimev3      DATETIMEV2(6)   No      false   \N      MAX     
true            
+test_rollup_agg_date   AGG_KEYS        datek1  DATE    DATEV2  Yes     true    
\N              true            
+               datetimek1      DATETIME        DATETIMEV2(0)   Yes     true    
\N              true            
+               datetimek2      DATETIME        DATETIMEV2(3)   Yes     true    
\N              true            
+               datetimek3      DATETIME        DATETIMEV2(6)   Yes     true    
\N              true            
+               datev1  DATE    DATEV2  No      false   \N      MAX     true    
        
+               datetimev1      DATETIME        DATETIMEV2(0)   No      false   
\N      MAX     true            
+               datetimev2      DATETIME        DATETIMEV2(3)   No      false   
\N      MAX     true            
+               datetimev3      DATETIME        DATETIMEV2(6)   No      false   
\N      MAX     true            
+               datetimev4      DATETIME        DATETIMEV2(3)   Yes     false   
\N      MAX     true            
+                                                                               
        
+rollup_date    AGG_KEYS        datek1  DATE    DATEV2  Yes     true    \N      
        true            
+               datetimek2      DATETIME        DATETIMEV2(3)   Yes     true    
\N              true            
+               datetimek1      DATETIME        DATETIMEV2(0)   Yes     true    
\N              true            
+               datetimek3      DATETIME        DATETIMEV2(6)   Yes     true    
\N              true            
+               datev1  DATE    DATEV2  No      false   \N      MAX     true    
        
+               datetimev1      DATETIME        DATETIMEV2(0)   No      false   
\N      MAX     true            
+               datetimev2      DATETIME        DATETIMEV2(3)   No      false   
\N      MAX     true            
+               datetimev3      DATETIME        DATETIMEV2(6)   No      false   
\N      MAX     true            
 
 -- !sql --
 2022-08-23     2022-08-23T11:11:11     2022-08-23T11:11:11.111 
2022-08-23T11:11:11.111111      2022-08-23      2022-08-23T11:11:11     
2022-08-23T11:11:11.111 2022-08-23T11:11:11.111111
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
new file mode 100644
index 0000000000..e2c81ce67e
--- /dev/null
+++ b/regression-test/suites/query_p0/show/test_show_create_table.groovy
@@ -0,0 +1,44 @@
+// 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_show_create_table", "query") {
+    String tb_name = "tb_show_create_table";
+    try {  
+        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 MAX NOT NULL COMMENT "e",
+                datetimev1 datetimev2 MAX NOT NULL COMMENT "f",
+                datetimev2 datetimev2(3) MAX NOT NULL COMMENT "g",
+                datetimev3 datetimev2(6) MAX NOT NULL COMMENT "h"
+            )
+            AGGREGATE KEY (datek1, datetimek1, datetimek2, datetimek3)
+            DISTRIBUTED BY HASH(datek1) 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to