xylaaaaa opened a new pull request, #71197: URL: https://github.com/apache/doris/pull/71197
### Background Catalog system tables expose metadata through native scans or table-valued functions. SQL result caching validates the table dependencies recorded during analysis before reusing a result. ### What problem does this PR solve? Issue Number: None Related PR: #70536 (discovered during Delta M2 review) PR Type: Bugfix Problem Summary: System-table binding returns before the usual SQL cache dependency registration. If optimization removes the system-table relation, a result can be cached without tracking its source table. A repeated query can then reuse the old result after that table has been dropped. ### Details - **Frequency** This affects eligible queries with SQL Cache enabled, including a folded native system-table subquery or a Hive partition system table reduced to an empty relation. - **Root cause** Both system-table branches leave relation binding before the ordinary table version is recorded. - **Coverage** The new binder test exercises both branches with an enabled SQL cache context. - **Fix** Mark the statement ineligible for SQL Cache after successful system-table resolution and before choosing the native or TVF plan. ### Testing - `./build.sh --fe` with Maven 3.9.9, including Checkstyle. - `./run-fe-ut.sh --run 'BindRelationTest,PluginDrivenSysTableTest,PluginTableCacheAnalyzerTest,NereidsSqlCacheManagerPluginTableTest'` passed 37 tests. - Local FE/BE SQL checks with an Iceberg snapshots subquery and a Hive partitions query that folds to an empty relation. Both bypassed cache after repeated execution and reported a missing table after the source table was dropped. An ordinary Iceberg base-table control hit cache before the drop and invalidated afterward. The temporary FE used execution version 19 to match the reused BE. ### Release note Queries referencing catalog system tables bypass SQL result caching, including when optimization removes the system-table scan. ### Check List (For Author) - Test: FE unit tests and local Iceberg and Hive SQL checks - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: OpenAI Codex - Generated: The code, tests, and PR description - Human review: Maintainer review pending -- 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]
