MDEV-35920: Fix assertion failure "decimals == 0" in Item_func_mod::fix_length_and_dec_int#5079
Open
pranavktiwari wants to merge 1 commit into
Open
MDEV-35920: Fix assertion failure "decimals == 0" in Item_func_mod::fix_length_and_dec_int#5079pranavktiwari wants to merge 1 commit into
pranavktiwari wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes a bug where hex hybrid types resulted in incorrect decimal values during arithmetic operations by introducing the aggregate_attributes_hex_hybrid method and updating the Type_handler_hex_hybrid class. Feedback suggests refactoring the new method to reuse existing logic and reduce duplication, updating the documentation for accuracy, and correcting the issue reference prefix in the test files.
| @@ -0,0 +1,11 @@ | |||
| --echo # | |||
| --echo # DEV-35920: Hex hybrid type causing invalid decimals in arithmetic context | |||
| @@ -0,0 +1,15 @@ | |||
| # | |||
| # DEV-35920: Hex hybrid type causing invalid decimals in arithmetic context | |||
550a7b3 to
c3dbe4c
Compare
…_length_and_dec_int Hex hybrid literals (0x..) were incorrectly treated as string values during hybrid expression aggregation (CASE/COALESCE/IF/LEAST/IFNULL), causing NOT_FIXED_DEC to propagate into numeric contexts. This led to an assertion failure in MOD() which requires decimals == 0 for integer arithmetic. Fix ensures hex hybrid values retain string collation behavior but enforce numeric semantics by setting decimals = 0 and unsigned_flag = true. Add regression test for MOD() with hex in hybrid expressions
c3dbe4c to
82bb1bc
Compare
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.
Hex hybrid literals (0x..) were incorrectly treated as string values during hybrid
expression aggregation (CASE/COALESCE/IF/LEAST/IFNULL), causing NOT_FIXED_DEC to
propagate into numeric contexts. This led to an assertion failure in MOD() which
requires decimals == 0 for integer arithmetic.
Fix ensures hex hybrid values retain string collation behavior but enforce numeric
semantics by setting decimals = 0 and unsigned_flag = true.
Add regression test for MOD() with hex in hybrid expressions.