Fix optimized sibling check for JDBC persistence#4580
Open
venkateshwaracholan wants to merge 4 commits into
Open
Fix optimized sibling check for JDBC persistence#4580venkateshwaracholan wants to merge 4 commits into
venkateshwaracholan wants to merge 4 commits into
Conversation
dimas-b
reviewed
May 30, 2026
Contributor
dimas-b
left a comment
There was a problem hiding this comment.
Thanks again for your contribution, @venkateshwaracholan !
| // JDBC materializes persisted rows as PolarisBaseEntity, so use the stored location | ||
| // property instead of casting to LocationBasedEntity. | ||
| String siblingBaseLocation = | ||
| result.getPropertiesAsMap().get(PolarisEntityConstants.ENTITY_BASE_LOCATION); |
Contributor
There was a problem hiding this comment.
WDYT about using PolarisEntityUtils.asLocationBasedEntity()?
Contributor
Author
There was a problem hiding this comment.
@dimas-b Switched to PolarisEntityUtils.asLocationBasedEntity() as suggested. Thanks!
dimas-b
previously approved these changes
Jun 2, 2026
Comment on lines
+814
to
+816
| // JDBC materializes persisted rows as PolarisBaseEntity; resolve location via entity | ||
| // utils | ||
| // instead of casting to LocationBasedEntity. |
| void testHasOverlappingSiblingsUsesStoredBaseLocation() { | ||
| // The optimized check relies on the location_without_scheme column added in schema v2. | ||
| if (schemaVersion() < 2) { | ||
| return; |
Contributor
There was a problem hiding this comment.
nit: assumeThat(schemaVersion()).isLessThan(2)?
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.
Fixes #3378
This fixes a
ClassCastExceptionin the JDBC optimized sibling location check whenOPTIMIZED_SIBLING_CHECK=true.JDBC persistence materializes queried entities as
PolarisBaseEntity, but the optimized sibling check assumed results could be cast toLocationBasedEntity. This caused table creation to fail when optimized sibling checking was enabled.The fix uses the persisted base location property stored on the entity instead of relying on a runtime type cast. Existing overlap detection behavior is preserved.
Added regression coverage for JDBC schema versions that support
location_without_scheme, including both overlapping and non-overlapping sibling location scenarios.Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)