It looks like the '%' operator breaks in the following scenario:
decimal(18,0) + Any value greater than INT (2147483647)
As far as I can tell, `%` will typically use the proper mod function transparently, but instead of using/casting as BIGINT, it will use INT, and then overflow. If I directly cast as BIGINT, it will work as expected.
|num||num % 3||mod(num, 3)|
If the number is used directly (i.e. not using a column), it works as expected:
|42607032167 % 3||mod(42607032167, 3)|
According to the documentation, these should be equivalent
mod(numeric_type a, same_type b)
Purpose: Returns the modulus of a number. Equivalent to the % arithmetic operator. Works with any size integer type, any size floating-point type, and DECIMAL with any precision and scale.