-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression: fix the corner case of CAST int as unsigned real/decimal #13637
Changes from 10 commits
93d0bae
3cf5880
eecee7b
818cd2b
12e362a
a2a8b50
ed64f0c
b7b10b2
206c798
61704ce
b8110b6
6f79cd6
da7723d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,8 @@ func (b *builtinCastIntAsRealSig) vecEvalReal(input *chunk.Chunk, result *chunk. | |
} | ||
if !hasUnsignedFlag0 && !hasUnsignedFlag1 { | ||
rs[i] = float64(i64s[i]) | ||
} else if b.inUnion && i64s[i] < 0 { | ||
// Special case: In union statement, if output is unsigned, but input is signed, input value < 0, then result = 0 | ||
} else if b.inUnion && !hasUnsignedFlag1 && i64s[i] < 0 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's in a fop loop, maybe it's acceptable here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SunRunAway I am not mean the local variable, see: #13637 (comment), I mean this logic is not easy to understand. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not get you. What is your suggestion? |
||
rs[i] = 0 | ||
} else { | ||
// recall that, int to float is different from uint to float | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about: