ORCA: Fix detection of mixed storage in partitioned tables #1524
Open
yjhjstz wants to merge 1 commit intoapache:mainfrom
Open
ORCA: Fix detection of mixed storage in partitioned tables #1524yjhjstz wants to merge 1 commit intoapache:mainfrom
yjhjstz wants to merge 1 commit intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in ORCA's storage type detection for partitioned tables that contain a mix of foreign and non-foreign partitions. The issue caused incorrect metadata generation when such mixed storage configurations existed, which could lead to problems with scan type selection and query planning.
Changes:
- Added logic to detect and mark mixed storage when foreign partitions are encountered after non-foreign partitions (or vice versa)
- Converted an independent
ifstatement to anelse ifto create a proper conditional chain for storage type transitions - Improved handling of the initial state when the first partition encountered is foreign
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leborchuk
reviewed
Jan 12, 2026
my-ship-it
requested changes
Jan 23, 2026
Contributor
my-ship-it
left a comment
There was a problem hiding this comment.
Add test cases for bug verification purpose?
450e873 to
3527e35
Compare
Member
Author
Added minidump to verify: grep -o 'StorageType="[^"]*"' src/backend/gporca/data/dxl/minidump/MixedPartitioned-ForeignHeap-Test.mdp/MixedPartitioned-ForeignHeap-Test.mdp |sort|uniq
StorageType="Foreign"
StorageType="Heap"
StorageType="MixedPartitioned" |
tuhaihe
reviewed
Jan 26, 2026
src/backend/gporca/data/dxl/minidump/MixedPartitioned-ForeignHeap-Test.mdp
Show resolved
Hide resolved
3527e35 to
7feb1df
Compare
…gn partitions The storage type detection logic failed to properly identify mixed storage when foreign and non-foreign partitions coexisted, leading to incorrect metadata that could cause issues with scan type selection and query planning.
7feb1df to
0a74903
Compare
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.
The storage type detection logic failed to properly identify mixed storage when foreign and non-foreign partitions coexisted, leading to incorrect metadata that could cause issues with scan type selection and query planning.
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions