Repository navigation
Fix if function type mismatch between UInt64 and Int32 - #96012
Merged
Merged
Conversation
When combining UInt64 (from floor of a large literal that fits in Int64) with Int32 in an if expression, the result type should be Int64. The `canUnsignedBeSigned` flag on DataTypeUInt64 indicates this, but it can be lost during distributed query plan transformations. When the flag is lost, the execution produces Int128 instead of the expected Int64. This fix adds a check: when the expected result_type is Int64 but arguments are UInt64 and another integer type (and the flag is not present), use a new `executeGenericWithType` function to properly cast both columns to the expected result type. Closes #70017 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
|
Workflow [PR], commit [afe5926] Summary: ❌
|
Avogar
approved these changes
Feb 6, 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.
When combining UInt64 (from
floorof a large literal that fits in Int64) with Int32 in an if expression, the result type should be Int64. ThecanUnsignedBeSignedflag on DataTypeUInt64 indicates this, but it can be lost during distributed query plan transformations. When the flag is lost, the execution produces Int128 instead of the expected Int64.This fix adds a check: when the expected result_type is Int64 but arguments are UInt64 and another integer type (and the flag is not present), use a new
executeGenericWithTypefunction to properly cast both columns to the expected result type.Closes #70017
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
iffunction type mismatch betweenUInt64andInt32in an unusual case of distributed queries and PREWHERE, with type inference. Closes #70017.@Avogar, I'm surprised we have such weird code. But as long as we have a bug fix, I'm ready to take it.
Version info
26.2.1.316