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 ffe7af49c8 [fix](array-type) run 'show create table' return null 
(#11912)
ffe7af49c8 is described below

commit ffe7af49c8a446ea6f2b71f2e96eac1e18b71201
Author: carlvinhust2012 <[email protected]>
AuthorDate: Fri Aug 19 21:28:15 2022 +0800

    [fix](array-type) run 'show create table' return null (#11912)
    
    Co-authored-by: hucheng01 <[email protected]>
---
 .../org/apache/doris/catalog/TableProperty.java    |  2 +-
 .../data/query/show/test_array_show_create.out     |  4 ++
 .../query/show/test_array_show_create.groovy       | 72 ++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java
index 8ff2962686..c57d85a90b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java
@@ -75,7 +75,7 @@ public class TableProperty implements Writable {
 
     private boolean enableLightSchemaChange = false;
 
-    private Boolean disableAutoCompaction;
+    private boolean disableAutoCompaction = false;
 
     private DataSortInfo dataSortInfo = new DataSortInfo();
 
diff --git a/regression-test/data/query/show/test_array_show_create.out 
b/regression-test/data/query/show/test_array_show_create.out
new file mode 100644
index 0000000000..fd1da0cb7a
--- /dev/null
+++ b/regression-test/data/query/show/test_array_show_create.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select --
+test_array_show_create CREATE TABLE `test_array_show_create` (\n  `k1` int(11) 
NULL,\n  `k2` array<smallint(6)> NOT NULL,\n  `k3` array<int(11)> NOT NULL,\n  
`k4` array<bigint(20)> NOT NULL,\n  `k5` array<char(1)> NOT NULL,\n  `k6` 
array<varchar(20)> NULL,\n  `k7` array<date> NOT NULL,\n  `k8` array<datetime> 
NOT NULL,\n  `k9` array<float> NOT NULL,\n  `k10` array<double> NOT NULL,\n  
`k11` array<decimal(20, 6)> NULL\n) ENGINE=OLAP\nDUPLICATE KEY(`k1`)\nCOMMENT 
'OLAP'\nDISTRIBUTED BY HAS [...]
+
diff --git a/regression-test/suites/query/show/test_array_show_create.groovy 
b/regression-test/suites/query/show/test_array_show_create.groovy
new file mode 100644
index 0000000000..b5692663f4
--- /dev/null
+++ b/regression-test/suites/query/show/test_array_show_create.groovy
@@ -0,0 +1,72 @@
+// 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_array_show_create", "query") {
+    // define a sql table
+    def testTable = "test_array_show_create"
+    
+    def create_test_table = {testTablex ->
+        // multi-line sql
+        sql "ADMIN SET FRONTEND CONFIG ('enable_array_type' = 'true')"
+        
+        def result1 = sql """
+            CREATE TABLE IF NOT EXISTS ${testTable} (
+              `k1` INT(11) NULL COMMENT "",
+              `k2` ARRAY<SMALLINT> NOT NULL COMMENT "",
+              `k3` ARRAY<INT(11)> NOT NULL COMMENT "",
+              `k4` ARRAY<BIGINT> NOT NULL COMMENT "",
+              `k5` ARRAY<CHAR> NOT NULL COMMENT "",
+              `k6` ARRAY<VARCHAR(20)> NULL COMMENT "",
+              `k7` ARRAY<DATE> NOT NULL COMMENT "", 
+              `k8` ARRAY<DATETIME> NOT NULL COMMENT "",
+              `k9` ARRAY<FLOAT> NOT NULL COMMENT "",
+              `k10` ARRAY<DOUBLE> NOT NULL COMMENT "",
+              `k11` ARRAY<DECIMAL(20, 6)> NULL COMMENT ""
+            ) ENGINE=OLAP
+            DUPLICATE KEY(`k1`)
+            DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+            PROPERTIES (
+            "replication_allocation" = "tag.location.default: 1",
+            "storage_format" = "V2"
+            )
+            """
+        
+        // DDL/DML return 1 row and 3 column, the only value is update row 
count
+        assertTrue(result1.size() == 1)
+        assertTrue(result1[0].size() == 1)
+        assertTrue(result1[0][0] == 0, "Create table should update 0 rows")
+        
+        // insert 1 row to check whether the table is ok
+        def result2 = sql """ INSERT INTO ${testTable} VALUES
+                        (100, [1, 2, 3], [32767, 32768, 32769], [65534, 65535, 
65536], ['a', 'b', 'c'], ["hello", "world"], 
+                        ['2022-07-13'], ['2022-07-13 12:30:00'], [0.33, 0.67], 
[3.1415926, 0.878787878], [4, 5.5, 6.67])
+                        """
+        assertTrue(result2.size() == 1)
+        assertTrue(result2[0].size() == 1)
+        assertTrue(result2[0][0] == 1, "Insert should update 1 rows")
+    }
+
+    try {
+        sql "DROP TABLE IF EXISTS ${testTable}"
+        create_test_table.call(testTable)
+
+        qt_select "show create table ${testTable}"
+    } finally {
+        try_sql("DROP TABLE IF EXISTS ${testTable}")
+    }
+
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to