fix: Optimizing internal schema lookup in TableSchemaResolver#18387
Merged
nsivabalan merged 1 commit intoapache:masterfrom Mar 27, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18387 +/- ##
============================================
- Coverage 68.36% 68.36% -0.01%
- Complexity 27566 27582 +16
============================================
Files 2432 2433 +1
Lines 133175 133283 +108
Branches 16023 16034 +11
============================================
+ Hits 91047 91114 +67
- Misses 35068 35112 +44
+ Partials 7060 7057 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Collaborator
danny0405
approved these changes
Mar 27, 2026
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.
Describe the issue this Pull Request addresses
Optimized TableSchemaResolver.getTableInternalSchemaFromCommitMetadata() to use short-circuit evaluation when searching for the most recent schema-updating instant. The previous implementation filtered the entire timeline and then called lastInstant(), which required processing all instants. The new implementation uses getReverseOrderedInstants().filter(...).findFirst() to stop as soon as the first (most recent) matching instant is found.
Summary and Changelog
Summary:
Users with tables that have long timelines will experience faster internal schema lookups, especially when recent commits contain non-schema-updating operations (CLUSTER, COMPACT, INDEX, LOG_COMPACT).
Changelog:
instead of filter(...).lastInstant()
Technical details:
Impact
Performance improvement with no behavioral changes:
Risk Level
low
Documentation Update
None required.
Contributor's checklist