Repository navigation
[fix](be) Make prefix page encoding and geography tests portable - #71463
Open
morningman wants to merge 1 commit into
Open
morningman wants to merge 1 commit into
morningman wants to merge 1 commit into
Conversation
### Background PREFIX pages store the length shared by adjacent values and the remaining bytes. Doris uses them for string pages and Merge-on-Write primary key indexes. The GEOGRAPHY tests also exercise cases near the rounding limits of S2's spherical coordinates. ### What problem does this PR solve? Issue Number: None Related PR: apache#71462 (recorded the failures), apache#68609 (page fixtures), apache#69032 (GEOGRAPHY tests) PR Type: Bugfix Problem Summary: A shared byte such as `0xE4` can compare unequal to itself in the PREFIX builder when plain `char` is signed. That changes page boundaries and primary key index sizes between platforms. Two VGeo tests also relied on platform-dependent rounding for an almost collapsed ring and for the legacy WKB parser's treatment of a near-antipodal edge. ### Details - **Change map:** A one-line encoder correction and a focused byte-level regression. Two page fixture files and 46 segment fixtures are regenerated. The VGeo test changes preserve proximity and typed shell admission coverage and give the legacy parser a stable exterior-hole case. - **Frequency:** Always when a signed-char build compares a shared high-bit byte. The original fixture comparisons exposed four Linux ARM64 failures, and two VGeo cases failed on macOS ARM64. - **Root cause:** `BinaryPrefixPageBuilder` compared a plain `char` with the previous entry's `uint8_t`. Integer promotion made the same high-bit octet compare unequal. The VGeo fixtures assumed that an extremely narrow polygon survives conversion to S2 and that legacy WKB rejects the same near-antipodal shell on each platform. - **Why existing tests missed it:** The basic `BinaryPrefixPageTest` values are ASCII. The storage fixtures check physical bytes, and their checked-in baseline came from the signed-char representation. SQL coverage such as `test_primary_key_simple_case` checks data and key semantics at readback. - **Fix:** Compare unsigned octets. The page format already supports either shared-prefix length, so the same decoder reads existing and new pages. Use a representable nearby ring for the VGeo proximity check. Keep the typed near-antipodal shell test and test legacy exterior-hole rejection separately. - **Other paths and branches:** String pages and primary key indexes share this builder. The same comparison is present on branches 3.1, 4.0, 4.1, and 4.2. This change targets master. ### Testing - The new high-bit prefix regression failed on macOS ARM64 ASAN before the encoder change. The second entry stored both bytes instead of sharing `0xE4`. - macOS ARM64 ASAN and Docker Linux ARM64 ASAN each passed the same 198 targeted tests in registration order and with shuffle seed 48256. All four runs had zero config diagnostics. The selection covers `BinaryPrefixPageTest`, `PrimaryKeyIndexTest`, PREFIX strings, page and segment fixtures, and the full VGeo suite. - Regeneration on the fixed Linux build produced all 8 page fixture files and all 148 segment fixtures byte for byte. ### Release note None ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: OpenAI Codex (GPT-6) - Generated: The fix, test changes, fixture generation and verification, and PR description. - Human review: not stated Co-Authored-By: OpenAI Codex <codex@openai.com>
morningman
requested review from
airborne12,
csun5285,
eldenmoon,
gavinchou,
liaoxin01 and
yiguolei
as code owners
December 5, 2026 14:27
Contributor
Author
|
run buildall |
1 similar comment
Contributor
|
run buildall |
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.
Background
PREFIX pages store the length shared by adjacent values and the remaining bytes. Doris uses them for string pages and Merge-on-Write primary key indexes. The GEOGRAPHY tests also exercise cases near the rounding limits of S2's spherical coordinates.
What problem does this PR solve?
Issue Number: None
Related PR: #71462 (recorded the failures), #68609 (page fixtures), #69032 (GEOGRAPHY tests)
PR Type: Bugfix
Problem Summary:
A shared byte such as
0xE4can compare unequal to itself in the PREFIX builder when plaincharis signed. That changes page boundaries and primary key index sizes between platforms. Two VGeo tests also relied on platform-dependent rounding for an almost collapsed ring and for the legacy WKB parser's treatment of a near-antipodal edge.Details
BinaryPrefixPageBuildercompared a plaincharwith the previous entry'suint8_t. Integer promotion made the same high-bit octet compare unequal. The VGeo fixtures assumed that an extremely narrow polygon survives conversion to S2 and that legacy WKB rejects the same near-antipodal shell on each platform.BinaryPrefixPageTestvalues are ASCII. The storage fixtures check physical bytes, and their checked-in baseline came from the signed-char representation. SQL coverage such astest_primary_key_simple_casechecks data and key semantics at readback.Testing
0xE4.BinaryPrefixPageTest,PrimaryKeyIndexTest, PREFIX strings, page and segment fixtures, and the full VGeo suite.Release note
None
Check List (For Author)
AI Disclosure