ClickHouse server version 20.8.9 revision 54438

Let's imagine some simple table structure:

```
CREATE TABLE users (
    `user_id` Int32
)
```

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**.

```
SELECT 
    user_id % 150, 
    441746 % 150,
    toTypeName(user_id % 150),
    toTypeName(441746 % 150)
FROM users 
WHERE user_id = 441746
LIMIT 1
```

```
┌─modulo(user_id, 150)─┬─modulo(441746, 150)─┬─toTypeName(modulo(user_id, 150))─┬─toTypeName(modulo(441746, 150))─┐
│                -110  │                 146 │ Int8                             │ UInt8                           │
└──────────────────────┴─────────────────────┴──────────────────────────────────┴─────────────────────────────────┘
```
std::conditional_t<IsDecimalNumber<A> && IsDecimalNumber<B>, std::conditional_t<(sizeof(A) > sizeof(B)), A, B>, Error>>;
};
template <typename A> struct ToInteger
{
    using Type = typename Construct<
        is_signed_v<A>,
        false,
        std::is_floating_point_v<A> ? 8 : sizeof(A)>::Type;
};
template <typename A, typename B>
constexpr bool LeastGreatestSpecialCase =
    std::is_integral_v<A> && std::is_integral_v<B>
    && (8 == sizeof(A) && sizeof(A) == sizeof(B))
    && (is_signed_v<A> ^ is_signed_v<B>);
template <typename A, typename B>
using ResultOfLeast = std::conditional_t<LeastGreatestSpecialCase<A, B>,
    typename Construct<true, false, sizeof(A)>::Type,
    typename ResultOfIf<A, B>::Type>;
template <typename A, typename B>
using ResultOfGreatest = std::conditional_t<LeastGreatestSpecialCase<A, B>,
    typename Construct<false, false, sizeof(A)>::Type,
    typename ResultOfIf<A, B>::Type>;
}
template <typename T>
static inline auto littleBits(const T & x)
{
    return static_cast<UInt8>(x);
}
}