Skip to content

Fix mac val cast problem - #1200

Merged
hnwyllmm merged 3 commits into
masterfrom
issue/2026072400117700194
Jul 28, 2026
Merged

Fix mac val cast problem#1200
hnwyllmm merged 3 commits into
masterfrom
issue/2026072400117700194

Conversation

@ep-12221

@ep-12221 ep-12221 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Task Description

Static cast long long overflow.

Solution Description

Enhance range checking.

Passed Regressions

core-test

Upgrade Compatibility

Other Information

Release Note

@ep-12221

Copy link
Copy Markdown
Contributor Author

The mapping Dima issue is about the precision conversion problem in Mac seekdb's small farm.

@hnwyllmm

Copy link
Copy Markdown
Member

[P2] In round_floating_to_uint64, the checks for rounded <= INT64_MIN_AS_DOUBLE and rounded >= UINT64_UPPER_BOUND_AS_DOUBLE are handled before checking is_column_convert. In non-strict mode, OB_DATA_OUT_OF_RANGE is downgraded to a warning, but the current out_val is still persisted. This leads to incorrect results for extreme values in unsigned columns: a DOUBLE value of -2e28 gets written as 2^63 (MySQL should clamp it to 0), and a DOUBLE value of +2e28 gets written as INT64_MAX (MySQL should clamp it to UINT64_MAX; the FLOAT path writes it as 2^63). MySQL's Field_longlong::store(double) handles negative numbers and upper bounds according to unsigned column semantics first: https://github.com/mysql/mysql-server/blob/8.0/sql/field.cc. It is suggested to move the column-convert branch earlier, so negative numbers uniformly output 0 and values reaching 2^64 output UINT64_MAX. The non-column-convert branch should retain the existing differences between FLOAT/DOUBLE CAST AS UNSIGNED. Also, add test cases for FLOAT/DOUBLE ±2e28 -> BIGINT UNSIGNED column conversion, as the current unit tests do not cover these two boundaries.

@hnwyllmm
hnwyllmm force-pushed the issue/2026072400117700194 branch from 062b5df to f19b3fd Compare July 28, 2026 03:27
@ep-12221 ep-12221 changed the title Fix macro value cast problem Fix mac val cast problem Jul 28, 2026
@hnwyllmm
hnwyllmm merged commit 5fbefb6 into oceanbase:master Jul 28, 2026
2 checks passed
@ep-12221
ep-12221 deleted the issue/2026072400117700194 branch July 28, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants