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

dataroaring 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 c8bc6d01411 [test](regression) Add more regression test for FE (#26539)
c8bc6d01411 is described below

commit c8bc6d01411645eaec7570abbc15c3199013c1b2
Author: walter <[email protected]>
AuthorDate: Tue Nov 7 23:15:20 2023 +0800

    [test](regression) Add more regression test for FE (#26539)
---
 .../data/schema_change_p0/test_rename_column.out   | Bin 4097 -> 4171 bytes
 .../show_p0/test_show_create_table_and_views.out   |  46 ++++++++
 .../data/show_p0/test_show_table_and_views.out     |  40 +++++++
 regression-test/suites/node_p0/test_backend.groovy |   8 +-
 .../schema_change_p0/test_rename_column.groovy     |   5 +
 .../test_show_create_table_and_views.groovy        | 124 +++++++++++++++++++++
 .../sql_block_rule_p0/test_sql_block_rule.groovy   |  16 +++
 .../suites/statistics/test_basic_statistics.groovy |   1 +
 8 files changed, 239 insertions(+), 1 deletion(-)

diff --git a/regression-test/data/schema_change_p0/test_rename_column.out 
b/regression-test/data/schema_change_p0/test_rename_column.out
index 3e8d56d043e..c55ccab9e0f 100644
Binary files a/regression-test/data/schema_change_p0/test_rename_column.out and 
b/regression-test/data/schema_change_p0/test_rename_column.out differ
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
new file mode 100644
index 00000000000..ccd97f308f5
--- /dev/null
+++ b/regression-test/data/show_p0/test_show_create_table_and_views.out
@@ -0,0 +1,46 @@
+-- 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 [...]
+
+-- !select --
+1      1       30
+1      2       5
+1      3       10
+1      300     2
+2      1       100
+2      2       10
+2      3       44
+2      200     1111
+3      1       10
+3      2       1
+23     900     1
+100    100     1
+200    20      1
+300    20      1
+
+-- !select --
+1      5
+2      10
+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
+
+-- !select --
+1      47
+2      1265
+3      11
+23     1
+100    1
+200    1
+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 --
+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 --
+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 [( [...]
+
diff --git a/regression-test/data/show_p0/test_show_table_and_views.out 
b/regression-test/data/show_p0/test_show_table_and_views.out
new file mode 100644
index 00000000000..1d636c5a011
--- /dev/null
+++ b/regression-test/data/show_p0/test_show_table_and_views.out
@@ -0,0 +1,40 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !show --
+show_table_and_views_table     CREATE TABLE `show_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")),\nPARTITION p5 VALU [...]
+
+-- !select --
+1      300     2
+1      1       30
+1      2       5
+1      3       10
+2      200     1111
+2      1       100
+2      2       10
+2      3       44
+3      1       10
+3      2       1
+23     900     1
+100    100     1
+200    20      1
+300    20      1
+
+-- !select --
+1      5
+2      10
+3      1
+
+-- !show --
+show_table_and_views_view      CREATE VIEW `show_table_and_views_view` COMMENT 
'VIEW' AS SELECT `user_id` AS `user_id`, `cost` AS `cost` FROM 
`default_cluster:show_table_and_views_db`.`show_table_and_views_table` WHERE 
`good_id` = 2;      utf8    utf8_general_ci
+
+-- !select --
+1      47
+2      1265
+3      11
+23     1
+100    1
+200    1
+300    1
+
+-- !show --
+show_table_and_views_table     CREATE TABLE `show_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")),\nPARTITION p5 VALU [...]
+
diff --git a/regression-test/suites/node_p0/test_backend.groovy 
b/regression-test/suites/node_p0/test_backend.groovy
index 30184fe7652..5de31b1f964 100644
--- a/regression-test/suites/node_p0/test_backend.groovy
+++ b/regression-test/suites/node_p0/test_backend.groovy
@@ -28,9 +28,15 @@ suite("test_backend") {
         result = sql """SHOW BACKENDS;"""
         logger.info("result:${result}")
 
+        sql """ALTER SYSTEM MODIFY BACKEND "${address}:${notExistPort}" SET 
("disable_query" = "true"); """
+        sql """ALTER SYSTEM MODIFY BACKEND "${address}:${notExistPort}" SET 
("disable_load" = "true"); """
+
+        result = sql """SHOW BACKENDS;"""
+        logger.info("result:${result}")
+
         sql """ALTER SYSTEM DROPP BACKEND "${address}:${notExistPort}";"""
 
         result = sql """SHOW BACKENDS;"""
         logger.info("result:${result}")
     }
-}
\ No newline at end of file
+}
diff --git a/regression-test/suites/schema_change_p0/test_rename_column.groovy 
b/regression-test/suites/schema_change_p0/test_rename_column.groovy
index 558888954cf..7a98a0cd3ec 100644
--- a/regression-test/suites/schema_change_p0/test_rename_column.groovy
+++ b/regression-test/suites/schema_change_p0/test_rename_column.groovy
@@ -232,8 +232,11 @@ suite ("test_rename_column") {
             }
         }
     }
+    String viewName = "renameColumnView1"
+    sql "create view ${viewName} (user_id, max_cost) as select user_id, 
max(cost) as max_cost from ${tableName} group by user_id"
 
     qt_select """ select user_id, cost from ${tableName} order by user_id """
+    qt_select """ select user_id, max_cost, "${viewName}" from ${viewName} 
order by user_id """
 
     sql """ INSERT INTO ${tableName} VALUES
             (1, '2017-10-01', 'Beijing', 10, 1, 1, 30, 20, hll_hash(1), 
to_bitmap(1))
@@ -261,9 +264,11 @@ suite ("test_rename_column") {
     qt_desc """ desc ${tableName} """
 
     qt_select""" select * from ${tableName} order by user_id """
+    qt_select """ select user_id, max_cost, "${viewName}" from ${viewName} 
order by user_id """
 
     qt_select """ select user_id, sum(cost) from ${tableName} group by user_id 
order by user_id """
 
+    sql """ DROP VIEW ${viewName} """
     sql """ DROP TABLE ${tableName} """
 
 }
diff --git 
a/regression-test/suites/show_p0/test_show_create_table_and_views.groovy 
b/regression-test/suites/show_p0/test_show_create_table_and_views.groovy
new file mode 100644
index 00000000000..89670aa434f
--- /dev/null
+++ b/regression-test/suites/show_p0/test_show_create_table_and_views.groovy
@@ -0,0 +1,124 @@
+// 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_and_views", "show") {
+    def ret = sql "ADMIN SHOW FRONTEND CONFIG like '%enable_feature_binlog%';"
+    logger.info("${ret}")
+    if (ret.size() != 0 && ret[0].size() > 1 && ret[0][1] == 'false') {
+        logger.info("enable_feature_binlog=false in frontend config, no need 
to run this case.")
+        return
+    }
+
+    String suiteName = "show_create_table_and_views"
+    String dbName = "${suiteName}_db"
+    String tableName = "${suiteName}_table"
+    String viewName = "${suiteName}_view"
+    String rollupName = "${suiteName}_rollup"
+    String likeName = "${suiteName}_like"
+
+    sql "CREATE DATABASE IF NOT EXISTS ${dbName}"
+    sql "DROP TABLE IF EXISTS ${dbName}.${tableName}"
+    sql """
+        CREATE TABLE ${dbName}.${tableName} (
+            `user_id` LARGEINT NOT NULL,
+            `good_id` LARGEINT NOT NULL,
+            `cost` BIGINT SUM DEFAULT "0",
+        )
+        AGGREGATE KEY(`user_id`, `good_id`)
+        PARTITION BY RANGE(`good_id`)
+        (
+            PARTITION p1 VALUES LESS THAN ("100"),
+            PARTITION p2 VALUES LESS THAN ("200"),
+            PARTITION p3 VALUES LESS THAN ("300"),
+            PARTITION p4 VALUES LESS THAN ("400"),
+            PARTITION p5 VALUES LESS THAN ("500"),
+            PARTITION p6 VALUES LESS THAN ("600"),
+            PARTITION p7 VALUES LESS THAN MAXVALUE
+        )
+        DISTRIBUTED BY HASH(`user_id`) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        )
+        """
+
+    sql """INSERT INTO ${dbName}.${tableName} VALUES
+        (1, 1, 10),
+        (1, 1, 20),
+        (1, 2, 5),
+        (1, 3, 10),
+        (2, 1, 0),
+        (2, 1, 100),
+        (3, 1, 10),
+        (2, 2, 10),
+        (2, 3, 44),
+        (3, 2, 1),
+        (100, 100, 1),
+        (200, 20, 1),
+        (300, 20, 1),
+        (1, 300, 2),
+        (2, 200, 1111),
+        (23, 900, 1)"""
+
+    qt_show "SHOW CREATE TABLE ${dbName}.${tableName}"
+    qt_select "SELECT * FROM ${dbName}.${tableName} ORDER BY user_id, good_id"
+
+    // create view and show
+    sql """
+        CREATE VIEW IF NOT EXISTS ${dbName}.${viewName} (user_id, cost)
+        AS
+        SELECT user_id, cost FROM ${dbName}.${tableName}
+        WHERE good_id = 2
+    """
+    qt_select "SELECT * FROM ${dbName}.${viewName} ORDER BY user_id"
+    qt_show "SHOW CREATE VIEW ${dbName}.${viewName}"
+
+    // create rollup
+    sql """ALTER TABLE ${dbName}.${tableName}
+        ADD ROLLUP ${rollupName} (user_id, cost)
+    """
+
+    def isAlterTableFinish = { ->
+        def records = sql """SHOW ALTER TABLE ROLLUP FROM ${dbName}"""
+        for (def row in records) {
+            if (row[5] == "${rollupName}" && row[8] == "FINISHED") {
+                return true
+            }
+        }
+        false
+    }
+    while (!isAlterTableFinish()) {
+        Thread.sleep(100)
+    }
+
+    qt_select "SELECT user_id, SUM(cost) FROM ${dbName}.${tableName} GROUP BY 
user_id ORDER BY user_id"
+    qt_show "SHOW CREATE TABLE ${dbName}.${tableName}"
+
+    // create like
+    sql "CREATE TABLE ${dbName}.${likeName} LIKE ${dbName}.${tableName}"
+    qt_show "SHOW CREATE TABLE ${dbName}.${likeName}"
+
+    // create like with rollup
+    sql "CREATE TABLE ${dbName}.${likeName}_with_rollup LIKE 
${dbName}.${tableName} WITH ROLLUP"
+    qt_show "SHOW CREATE TABLE ${dbName}.${likeName}_with_rollup"
+
+    sql "DROP TABLE IF EXISTS ${dbName}.${likeName}_with_rollup FORCE"
+    sql "DROP TABLE ${dbName}.${likeName} FORCE"
+    sql "DROP VIEW ${dbName}.${viewName}"
+    sql "DROP TABLE ${dbName}.${tableName} FORCE"
+    sql "DROP DATABASE ${dbName} FORCE"
+}
+
diff --git 
a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy 
b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
index fed19fd7b69..978486d8afd 100644
--- a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
+++ b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
@@ -66,6 +66,22 @@ suite("test_sql_block_rule") {
         exception "sql match regex sql block rule: test_rule_sql"
     }
 
+    sql """
+        ALTER SQL_BLOCK_RULE test_rule_sql PROPERTIES("enable"="false")
+        """
+
+    sql "SELECT * FROM table_2"
+
+    sql """
+        ALTER SQL_BLOCK_RULE test_rule_sql
+        PROPERTIES("sql"="SELECT abcd FROM table_2", "global"= "true", 
"enable"= "true")
+    """
+
+    test {
+        sql("SELECT abcd FROM table_2", false)
+        exception "sql match regex sql block rule: test_rule_sql"
+    }
+
     sql """
                 DROP SQL_BLOCK_RULE if exists test_rule_sql
               """
diff --git a/regression-test/suites/statistics/test_basic_statistics.groovy 
b/regression-test/suites/statistics/test_basic_statistics.groovy
index a885ac1c11c..6ee54baa942 100644
--- a/regression-test/suites/statistics/test_basic_statistics.groovy
+++ b/regression-test/suites/statistics/test_basic_statistics.groovy
@@ -69,6 +69,7 @@ suite("test_basic_statistics") {
     assertTrue(result[0][6] == "\'name1\'")
     assertTrue(result[0][7] == "\'name9\'")
 
+    sql """drop stats ${tbl}"""
     sql """drop table ${tbl}"""
     sql """drop database ${db}"""
 


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

Reply via email to