[fix](case) one_col_range_partition: query a date range that has data#64523
Open
shuke987 wants to merge 1 commit into
Open
[fix](case) one_col_range_partition: query a date range that has data#64523shuke987 wants to merge 1 commit into
shuke987 wants to merge 1 commit into
Conversation
The CASE WHEN at this assertion simplifies to `dt >= '2021-05-01'`, but the table's data only spans 2020-01-01 ~ 2021-02-20 (10000 hours), so that range contains no data. The optimizer now correctly prunes the all-empty partitions to VEMPTYSET (verified: a plain `dt >= '2021-05-01'` prunes the same way, and inserting a matching row immediately makes it scan that partition and return the row), so the stale `partitions=417/1826` expectation no longer holds. This is not a correctness bug -- the result is correct (0 rows, nothing matches). Change the threshold to '2021-1-15' (within the data range) so the CASE WHEN prunes to a real, non-empty partition set; update the expected count to 37/1826. Scope check: this is the only stale assertion in the suite (the sibling CASE WHEN near line 261 still yields 417/1826 and is left unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
run buildall |
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
one_col_range_partitionfails on branch-4.1 P0 at the multi-branch CASE WHEN assertion (~line 256). The CASE WHEN simplifies todt >= '2021-05-01', but the table's data only spans 2020-01-01 ~ 2021-02-20 (10000 hours), so that range contains no data. The optimizer now correctly prunes the all-empty partitions to0:VEMPTYSET, so the stalecontains("partitions=417/1826")no longer matches.This is not a correctness bug — the result is correct (0 rows, nothing matches). Verified on a branch-4.1 cluster:
WHERE dt >= '2021-05-01'also prunes toVEMPTYSET(data-driven empty-partition pruning);dt = '2021-06-15'immediately flips the plan topartitions=1/1826and the row is returned — so VEMPTYSET never drops real data.Fix
Change the CASE WHEN's second threshold to
'2021-1-15'(inside the data range) so it prunes to a real, non-empty partition set, and update the expected count topartitions=37/1826. This keeps the assertion verifying that a multi-branch CASE WHEN is correctly pushed into partition pruning.Scope check: this is the only stale assertion in the suite — the sibling CASE WHEN near line 261 still yields
417/1826and is left unchanged.Verification
On a branch-4.1 cluster the rewritten CASE WHEN deterministically prunes to
partitions=37/1826(matchingdt >= '2021-01-15').🤖 Generated with Claude Code