Baymine opened a new pull request, #65889:
URL: https://github.com/apache/doris/pull/65889
### What problem does this PR solve?
Issue Number: close #65886
Problem Summary:
`CacheAnalyzer.buildCacheTableForOlapScanNode` iterates over the
`selectedPartitionIds` of an `OlapScanNode` and calls
`olapTable.getPartition(partitionId)` for each id. If a partition is dropped
between query planning and cache building (e.g. a concurrent `DROP PARTITION`),
`getPartition` returns `null`, and the subsequent
`partition.getVisibleVersionTime()` throws a `NullPointerException`, aborting
the cache update for the query.
Root cause: the loop had no null-check on the partition returned by
`getPartition`.
Fix: skip partitions that are already null (`if (partition == null)
continue;`). A dropped partition can no longer contribute to the cache, so it
is skipped and the remaining partitions are still processed. The end-to-end
effect is that the SQL cache update no longer crashes when a partition races
with the cache build; the cache is built from the still-existing partitions
instead.
### Release note
None
### Check List (For Author)
- Test
- [x] Unit Test
- Behavior changed:
- [ ] No.
- [x] Yes. A dropped partition no longer causes an NPE during SQL cache
building; it is skipped.
- Does this need documentation?
- [x] No.
--
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]