Details
Description
There are a lot of cases people want to get a positive modulo result.
For example, people want to bucket the data into 10 buckets. They use the hash code in Hive (based on Java) which can return a negative number. Then they need this POSITIVE_MOD(a, b) to return the results.
Otherwise they can still do it but it will be very verbose:
((hash(xxx) % 10) + 10) % 10
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
MySQL mod function (which returns negative numbers when the first number is negative) http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_mod