-
Notifications
You must be signed in to change notification settings - Fork 6.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
Incorrect modulo(a, b), a % b behavior for Int fields #20052
Comments
The type of constant So if you want the same result, maybe you can try:
|
A simple analysis: === code ==== template <> struct Construct<true, false, 1> { using Type = Int8; }; <<<< Maybe we should use Int16? |
You are right, we need to use larger signed type to accomodate the result. |
Minimal example: |
ClickHouse server version 20.8.9 revision 54438
Let's imagine some simple table structure:
Modulo operator on Int32 field with 150 argument returns negative result. This could have happened due to wrong type casting - result should be casted to Int16 or UInt8 instead of Int8.
The text was updated successfully, but these errors were encountered: