-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](block-rule) Skip SQL block rules check for EXPLAIN statements #59445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](block-rule) Skip SQL block rules check for EXPLAIN statements #59445
Conversation
- Modified ExplainCommand.java to remove checkBlockRules() call - EXPLAIN statements should not be blocked by SQL block rules - Updated test_sql_block_rule.groovy to expect EXPLAIN not blocked - Added comprehensive external table tests for Hive, Paimon, Iceberg - All tests verify EXPLAIN bypasses block rules for partition_num, tablet_num, cardinality, and regex rules
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modifies the behavior of EXPLAIN statements to skip SQL block rule validation, since EXPLAIN only shows execution plans without actually executing queries. The change removes the checkBlockRules() call from ExplainCommand.java and adds comprehensive test coverage across internal and external table types.
- Removed
checkBlockRules()call from ExplainCommand.java with clarifying comment - Updated existing SQL block rule test to verify EXPLAIN statements bypass validation
- Added comprehensive external table tests for Hive, Paimon, and Iceberg catalogs covering all block rule types (partition_num, tablet_num, cardinality, and regex)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExplainCommand.java | Removed checkBlockRules() call with explanatory comment about why EXPLAIN statements should skip block rule validation |
| regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy | Changed test to verify EXPLAIN statements are not blocked by regex SQL block rules |
| regression-test/suites/external_table_p0/paimon/test_paimon_sql_block_rule.groovy | New comprehensive test suite for Paimon external tables validating EXPLAIN bypasses all block rule types |
| regression-test/suites/external_table_p0/iceberg/test_iceberg_sql_block_rule.groovy | New comprehensive test suite for Iceberg external tables validating EXPLAIN bypasses all block rule types |
| regression-test/suites/external_table_p0/hive/test_external_sql_block_rule.groovy | Extended existing Hive test to verify EXPLAIN bypasses block rules for user-specific and global rules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 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""" |
Copilot
AI
Dec 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| sql """drop sql_block_rule hive_global_regex_rule""" | |
| 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""" |
TPC-H: Total hot run time: 35684 ms |
TPC-DS: Total hot run time: 174379 ms |
ClickBench: Total hot run time: 26.91 s |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 34258 ms |
TPC-DS: Total hot run time: 175275 ms |
ClickBench: Total hot run time: 26.82 s |
FE UT Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 35179 ms |
TPC-DS: Total hot run time: 174142 ms |
ClickBench: Total hot run time: 27.2 s |
|
run buildall |
FE Regression Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 35307 ms |
TPC-DS: Total hot run time: 174496 ms |
ClickBench: Total hot run time: 27.03 s |
|
run buildall |
morningman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
run external |
|
run cloud_p0 |
|
run vault_p0 |
…59445) - Modified ExplainCommand.java to remove checkBlockRules() call - EXPLAIN statements should not be blocked by SQL block rules - Updated test_sql_block_rule.groovy to expect EXPLAIN not blocked - Added comprehensive external table tests for Hive, Paimon, Iceberg - All tests verify EXPLAIN bypasses block rules for partition_num, tablet_num, cardinality, and regex rules
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)