yujun777 opened a new pull request, #68829:
URL: https://github.com/apache/doris/pull/68829

   ## What problem does this PR solve?
   
   `test_analyze` asserts that, after `DROP STATS tbl(col)` removes the column 
statistics, the next
   `SELECT * FROM tbl` throws because `forbid_unknown_col_stats` is on.
   
   That assertion is not deterministic: `DROP STATS` does not invalidate the 
SQL cache, and the
   statistics version is not part of the SQL cache key (the key is the SQL text 
plus the visible
   versions of the referenced tables, and `forbidUnknownColStats` is not 
declared as affecting the
   query result). So when an earlier `SELECT` of the same suite has been 
cached, the last `SELECT` is
   answered directly from the cache — `PhysicalPlanTranslator.translate()` 
never runs, and the
   `forbid_unknown_col_stats` guard is never evaluated.
   
   Whether a cache entry exists depends on `cache_last_version_interval_second` 
and on the age of the
   newly loaded data, which makes the case pass or fail depending on the 
surrounding suites. Setting
   `cache_last_version_interval_second` to a small value (the `sql_cache` suite 
does that with
   `ADMIN SET FRONTEND CONFIG`) reproduces the failure at `assert exception != 
null`.
   
   ## What is changed and how it works?
   
   Set `enable_sql_cache=false` before the `SELECT` / `ANALYZE` / `DROP STATS` 
sequence so every
   statement there is really planned and the statistics guard is evaluated. The 
rest of the case is
   unchanged.
   
   ## Release note
   
   None, this only changes a regression case.
   
   ## Check List
   
   - [ ] Document
   - [ ] New test
   - [x] Existing test pass or an issue has been submitted for an unrelated 
failure
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to not work as expected)
   - [ ] This change requires a documentation update
   
   ## Related PR
   
   None.
   


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