Copilot commented on code in PR #59445:
URL: https://github.com/apache/doris/pull/59445#discussion_r2650396728


##########
regression-test/suites/external_table_p0/hive/test_external_sql_block_rule.groovy:
##########
@@ -85,20 +85,81 @@ suite("test_external_sql_block_rule", 
"external_docker,hive,external_docker_hive
             sql """select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
             exception """sql hits sql block rule: external_hive_partition, 
reach partition_num : 3"""
         }
+        // Test EXPLAIN should not be blocked
+        sql """explain select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
     }
     // login as external_block_user2
     def result2 = connect('external_block_user2', '', context.config.jdbcUrl) {
         test {
             sql """select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
             exception """sql hits sql block rule: external_hive_partition2, 
reach tablet_num : 3"""
         }
+        // Test EXPLAIN should not be blocked
+        sql """explain select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
     }
     // login as external_block_user3
     def result3 = connect('external_block_user3', '', context.config.jdbcUrl) {
         test {
             sql """select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
             exception """sql hits sql block rule: external_hive_partition3, 
reach cardinality : 3"""
         }
+        // Test EXPLAIN should not be blocked
+        sql """explain select * from 
test_hive2_external_sql_block_rule.`default`.parquet_partition_table order by 
l_linenumber limit 10;"""
     }
-}
 
+    // Test global partition_num rule
+    sql """drop sql_block_rule if exists hive_global_partition_rule"""
+    sql """create sql_block_rule hive_global_partition_rule 
properties("partition_num" = "3", "global" = "true", "enable" = "true");"""
+    
+    test {
+        sql """select * from parquet_partition_table limit 10;"""
+        exception """sql hits sql block rule: hive_global_partition_rule, 
reach partition_num : 3"""
+    }
+
+    // Test EXPLAIN should not be blocked
+    sql """explain select * from parquet_partition_table limit 10;"""
+
+    sql """drop sql_block_rule hive_global_partition_rule"""
+
+    // Test global tablet_num (split) rule
+    sql """drop sql_block_rule if exists hive_global_split_rule"""
+    sql """create sql_block_rule hive_global_split_rule 
properties("tablet_num" = "3", "global" = "true", "enable" = "true");"""
+    
+    test {
+        sql """select * from parquet_partition_table limit 10;"""
+        exception """sql hits sql block rule: hive_global_split_rule, reach 
tablet_num : 3"""
+    }
+
+    // Test EXPLAIN should not be blocked
+    sql """explain select * from parquet_partition_table limit 10;"""
+
+    sql """drop sql_block_rule hive_global_split_rule"""
+
+    // Test global cardinality rule
+    sql """drop sql_block_rule if exists hive_global_cardinality_rule"""
+    sql """create sql_block_rule hive_global_cardinality_rule 
properties("cardinality" = "3", "global" = "true", "enable" = "true");"""
+    
+    test {
+        sql """select * from parquet_partition_table limit 10;"""
+        exception """sql hits sql block rule: hive_global_cardinality_rule, 
reach cardinality : 3"""
+    }
+
+    // Test EXPLAIN should not be blocked
+    sql """explain select * from parquet_partition_table limit 10;"""
+
+    sql """drop sql_block_rule hive_global_cardinality_rule"""
+
+    // Test global regex rule
+    sql """drop sql_block_rule if exists hive_global_regex_rule"""
+    sql """create sql_block_rule hive_global_regex_rule properties("sql" = 
"SELECT \\\\* FROM parquet_partition_table", "global" = "true", "enable" = 
"true");"""
+    
+    test {
+        sql """SELECT * FROM parquet_partition_table limit 10;"""
+        exception """sql match regex sql block rule: hive_global_regex_rule"""
+    }
+
+    // Test EXPLAIN should not be blocked by regex rule
+    sql """EXPLAIN SELECT * FROM parquet_partition_table limit 10;"""
+
+    sql """drop sql_block_rule hive_global_regex_rule"""

Review Comment:
   The test creates several users (external_block_user1, external_block_user2, 
external_block_user3) and SQL block rules (external_hive_partition, 
external_hive_partition2, external_hive_partition3) at the beginning of the 
test suite, but these resources are not cleaned up at the end of the test. This 
could cause issues for other tests or when re-running this test suite. Consider 
adding cleanup code before the closing brace to drop the users and rules.
   ```suggestion
       sql """drop sql_block_rule hive_global_regex_rule"""
   
       // Cleanup users created for SQL block rule tests
       sql """drop user if exists 'external_block_user1'"""
       sql """drop user if exists 'external_block_user2'"""
       sql """drop user if exists 'external_block_user3'"""
   
       // Cleanup SQL block rules created at the beginning of the suite
       sql """drop sql_block_rule if exists external_hive_partition"""
       sql """drop sql_block_rule if exists external_hive_partition2"""
       sql """drop sql_block_rule if exists external_hive_partition3"""
   ```



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