Newer Version Available
sign(n)
Returns 1 if the numeric value, n is positive. It returns -1 if the
n is negative, and 0 if n is 0. n can be
any real numeric value in the range of -1e308 <= n <= 1e308. If null is passed as an argument, sign() returns null. This function can only be
used in a foreach statement.
Example
1q = foreach q generate sign(value) as value;