Core: Adjust calculations for reserved field IDs#16441
Open
nastra wants to merge 2 commits into
Open
Conversation
adeecba to
563110b
Compare
nastra
commented
May 20, 2026
| long statsFieldId = | ||
| STATS_SPACE_FIELD_ID_START_FOR_METADATA_FIELDS | ||
| + (NUM_SUPPORTED_STATS_PER_COLUMN * (long) offset); | ||
| if (statsFieldId < 0 || statsFieldId > RESERVED_FIELD_IDS_START) { |
Contributor
Author
There was a problem hiding this comment.
we don't need to check for the overflow anymore, because that's already guaranteed that we only ever do this calculation for the field IDs in SUPPORTED_METADATA_FIELD_IDS
nastra
commented
May 20, 2026
| } | ||
|
|
||
| private static int fieldIdForStatsFieldFromReservedField(int statsFieldId) { | ||
| return Math.max( |
Contributor
Author
There was a problem hiding this comment.
this isn't needed anymore, because the caller already guarantees that 9000 <= statsFieldId < 1000, so this can never be negative
563110b to
60e24fe
Compare
anoopj
reviewed
May 20, 2026
| MetadataColumns.LAST_UPDATED_SEQUENCE_NUMBER.fieldId(), MetadataColumns.ROW_ID.fieldId()); | ||
| static final int NUM_SUPPORTED_STATS_PER_COLUMN = 200; | ||
| // the starting field ID of the stats space for data field IDs | ||
| static final int STATS_SPACE_FIELD_ID_START_FOR_METADATA_FIELDS = 9_000; |
Contributor
There was a problem hiding this comment.
Should we do a Precondition check in a static initializer block to make sure SUPPORTED_METADATA_FIELD_IDS in future don't exceed 5 (the number of slots available between 9K and 10K)?
Contributor
Author
There was a problem hiding this comment.
not sure it's worth it. Adding a new field to the set technically requires a spec change
anoopj
approved these changes
May 21, 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.
This adjusts the calculations around stats field IDs for data and metadata columns and also updates the code to only support stats for the stats ID range
[10_000, 200_000_000).The PR was created with the help of Claude Opus 4.7 and manually adjusted in a few places.