zhannngchen commented on code in PR #31666:
URL: https://github.com/apache/doris/pull/31666#discussion_r1512094001
##########
regression-test/suites/insert_p0/txn_insert.groovy:
##########
@@ -21,74 +21,197 @@
suite("txn_insert") {
def table = "txn_insert_tbl"
- sql """ DROP TABLE IF EXISTS $table """
- sql """
- create table $table (
- k1 int,
- k2 double,
- k3 varchar(100),
- k4 array<int>,
- k5 array<boolean>
- ) distributed by hash(k1) buckets 1
- properties("replication_num" = "1");
- """
-
- // begin and commit
- sql """begin"""
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql """insert into $table values(null, null, null, [null], [null, 0])"""
- sql "commit"
- sql "sync"
- order_qt_select1 """select * from $table"""
-
- // begin and rollback
- sql "begin"
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql "rollback"
- sql "sync"
- order_qt_select2 """select * from $table"""
-
- // begin 2 times and commit
- sql "begin"
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql "begin"
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql "commit"
- sql "sync"
- order_qt_select3 """select * from $table"""
-
- // begin 2 times and rollback
- sql "begin"
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql "begin"
- sql """insert into $table values(1, 2.2, "abc", [], [])"""
- sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
- sql "rollback"
- sql "sync"
- order_qt_select4 """select * from $table"""
-
- // write to table with mv
- table = table + "_mv"
- sql """ DROP TABLE IF EXISTS $table """
- sql """
- create table $table (
- id int default '10',
- c1 int default '10'
- ) distributed by hash(id, c1)
- properties('replication_num'="1");
- """
- createMV """ create materialized view mv_${table} as select c1 from
$table; """
- sql "begin"
- sql """insert into $table values(1, 2), (3, 4)"""
- sql """insert into $table values(5, 6)"""
- sql """insert into $table values(7, 8)"""
- sql "commit"
- sql "sync"
- order_qt_select5 """select * from $table"""
- order_qt_select6 """select c1 from $table"""
+ for (def use_nereids_planner : [false, true]) {
+ sql " SET enable_nereids_planner = $use_nereids_planner; "
+ sql " SET enable_fallback_to_original_planner = false; "
+
+ sql """ DROP TABLE IF EXISTS $table """
+ sql """
+ create table $table (
+ k1 int,
+ k2 double,
+ k3 varchar(100),
+ k4 array<int>,
+ k5 array<boolean>
+ ) distributed by hash(k1) buckets 1
+ properties("replication_num" = "1");
+ """
+
+ // begin and commit
+ sql """begin"""
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql """insert into $table values(null, null, null, [null], [null,
0])"""
+ sql "commit"
+ sql "sync"
+ order_qt_select1 """select * from $table"""
+
+ // begin and rollback
+ sql "begin"
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql "rollback"
+ sql "sync"
+ order_qt_select2 """select * from $table"""
+
+ // begin 2 times and commit
+ sql "begin"
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql "begin"
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql "commit"
+ sql "sync"
+ order_qt_select3 """select * from $table"""
+
+ // begin 2 times and rollback
+ sql "begin"
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql "begin"
+ sql """insert into $table values(1, 2.2, "abc", [], [])"""
+ sql """insert into $table values(2, 3.3, "xyz", [1], [1, 0])"""
+ sql "rollback"
+ sql "sync"
+ order_qt_select4 """select * from $table"""
+
+ // write to table with mv
+ def tableMV = table + "_mv"
+ do {
+ sql """ DROP TABLE IF EXISTS $tableMV """
+ sql """
+ create table $tableMV (
+ id int default '10',
+ c1 int default '10'
+ ) distributed by hash(id, c1)
+ properties('replication_num'="1");
+ """
+ createMV """ create materialized view mv_${tableMV} as select c1
from $tableMV; """
+ sql "begin"
+ sql """insert into $tableMV values(1, 2), (3, 4)"""
+ sql """insert into $tableMV values(5, 6)"""
+ sql """insert into $tableMV values(7, 8)"""
+ sql "commit"
+ sql "sync"
+ order_qt_select5 """select * from $tableMV"""
+ order_qt_select6 """select c1 from $tableMV"""
+ } while (0);
+
+ // ------------------- insert into select -------------------
+ for (int j = 0; j < 3; j++) {
+ def tableName = table + "_" + j
+ sql """ DROP TABLE IF EXISTS $tableName """
+ sql """
+ create table $tableName (
+ k1 int,
+ k2 double,
+ k3 varchar(100),
+ k4 array<int>,
+ k5 array<boolean>
+ ) distributed by hash(k1) buckets 1
+ properties("replication_num" = "1");
+ """
+ }
+
+ def result = sql """ show variables like
'enable_fallback_to_original_planner'; """
+ logger.info("variable: $result")
+
+ // 1. insert into select to 3 tables
Review Comment:
Add the comment here: batch insert into select only supports nereids
planner, and can't fallback
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]