EscaperLL opened a new pull request, #71264:
URL: https://github.com/apache/doris/pull/71264

   ### Background
   
   Doris BITMAP stores unsigned 64-bit members. Functions that expose these 
members as numbers currently return signed BIGINT, which cannot represent 
values above 9223372036854775807. LARGEINT can represent the full UInt64 range.
   
   ### What problem does this PR solve?
   
   Issue Number: close #71182
   Related PR: #5581 (introduced the signed minimum boundary), #6942 
(introduced the signed maximum boundary)
   PR Type: Bugfix
   
   Problem Summary:
   
   Extracting bitmap members above INT64_MAX returns negative values. This PR 
returns LARGEINT from bitmap numeric outputs and supports ARRAY<LARGEINT> round 
trips. Separate BE implementations preserve compatibility with old FEs during 
BE-first rolling upgrades; most of the diff covers tests and migration guidance.
   
   ```sql
   SELECT bitmap_max(to_bitmap('18446744073709551615'));
   -- Before: -1 (BIGINT)
   -- After: 18446744073709551615 (LARGEINT)
   ```
   
   ### Details
   
   - **Change map:** 227 changed production lines for typed outputs and FE/BE 
dispatch; 1,186 test lines, 476 generated-result lines and 163 documentation 
lines for boundary values, client metadata and upgrade guidance.
   - **Frequency:** Always when numeric outputs expose members above INT64_MAX.
   - **Root cause:** Bitmap numeric writers narrow UInt64 members to Int64. 
Changing existing BE implementations to Int128 alone would conflict with old FE 
return-type declarations during rolling upgrades.
   - **Why existing tests missed it:** Existing bitmap unit tests used small 
values or checked unsigned membership after signed export. Regression cases 
stopped at INT64_MAX; homogeneous cluster tests did not cover mixed FE/BE 
contracts.
   - **Fix:** Widen directly from UInt64 to Int128 and align FE signatures for 
bitmap_min, bitmap_max, bitmap_to_array, explode_bitmap, explode_bitmap_outer 
and bitmap UNNEST. New FEs select versioned BE implementations; legacy 
implementations retain BIGINT. bitmap_from_array accepts ARRAY<LARGEINT> 
members in [0, UINT64_MAX]; a NULL or out-of-range member returns NULL for the 
row.
   - **Other paths and branches:** Both scalar and table-function outputs are 
covered. Static inspection found the same pattern on branch-3.1, branch-4.0, 
branch-4.1 and branch-4.2; this PR includes no backports or release-branch 
testing.
   - **Behavior change:** Numeric outputs use LARGEINT even for small members, 
and bitmap_to_array returns ARRAY<LARGEINT>. Numeric array and generator 
payloads grow from 8 to 16 bytes per member. BITMAP storage and existing 
NULL/empty behavior are unchanged.
   
   ### Testing
   
   The reviewed implementation passed the following local checks before 
rebasing onto the current upstream base:
   
   - ASAN BE/FE build; 74 BE unit tests and 21 FE unit tests. The translator 
dispatch test failed before the fix and passed afterward.
   - Four regression suites covering UInt64 outputs, bitmap UNNEST, JDBC 
prepared statements and Arrow Flight SQL.
   - Seven rolling-upgrade stages with four FEs and two BEs; view migration and 
snapshot recovery checks.
   - clang-format 16, clang-tidy, header hygiene and FE Checkstyle.
   
   The feature additions and deletions are unchanged after rebasing. 
Mergeability, source whitespace and header hygiene passed on the new base; 
compilation and runtime tests have not been rerun there. Remote CI has not run.
   
   ### Release note
   
   Bitmap numeric outputs now preserve the full UInt64 range using LARGEINT. 
Upgrade all BEs before any FE, then upgrade Observer/Followers before Master. 
Refresh affected client/view schemas. Existing BITMAP data needs no rewrite.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes; migration guide included, with a 
website documentation follow-up recorded there.
   - Pre-submission status: Partially verified: reviewed implementation tested; 
build and runtime tests not rerun on the latest upstream base.
   
   ### AI Disclosure
   
   - Tool: Codex / GPT-6
   - Generated: Code, tests, documentation and this description.
   - Human review: The author reviewed and approved the implementation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to