dataroaring commented on code in PR #32980:
URL: https://github.com/apache/doris/pull/32980#discussion_r1566618862


##########
regression-test/suites/insert_p0/txn_insert.groovy:
##########
@@ -214,7 +228,145 @@ suite("txn_insert") {
             order_qt_select24 """select * from ${table}_2"""
         }
 
-        // 7. update stmt
+        // 7. insert into select to same table
+        if (use_nereids_planner) {
+            sql """ begin; """
+            sql """ insert into ${table}_0 select * from ${table}_1; """
+            sql """ insert into ${table}_0 select * from ${table}_2; """
+            sql """ insert into ${table}_0 select * from ${table}_1; """
+            sql """ insert into ${table}_0 select * from ${table}_2; """
+            sql """ commit; """
+            sql "sync"
+            order_qt_select25 """select * from ${table}_0"""
+
+            sql """ insert into ${table}_0 select * from ${table}_1; """
+            sql "sync"
+            order_qt_select26 """select * from ${table}_0"""
+
+            sql """ insert into ${table}_0 values(1001, 2.2, "abc", [], []) """
+            sql "sync"
+            order_qt_select27 """select * from ${table}_0"""
+
+            // select from observer fe
+            def observer_fe_url = get_observer_fe_url()
+            if (observer_fe_url != null) {
+                logger.info("observer url: $observer_fe_url")
+                connect(user = context.config.jdbcUser, password = 
context.config.jdbcPassword, url = observer_fe_url) {
+                    result = sql """ select count() from 
regression_test_insert_p0.${table}_0 """
+                    logger.info("select from observer result: $result")
+                    assertEquals(79, result[0][0])
+                }
+            }
+        }
+
+        // 8. insert into tables in different database
+        if (use_nereids_planner) {
+            def db2 = "regression_test_insert_p0_1"
+            sql """ create database if not exists $db2 """
+
+            try {
+                sql """ create table ${db2}.${table} like ${table} """
+                sql """ begin; """
+                sql """ insert into ${table} select * from ${table}_0; """
+                test {
+                    sql """ insert into $db2.${table} select * from 
${table}_0; """
+                    exception """Transaction insert must be in the same 
database, expect db_id"""
+                }
+            } finally {
+                sql """rollback"""

Review Comment:
   Please add a case that does not finally rollback. We also should add a case 
for timeout without explicit rollback.



-- 
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]

Reply via email to