Tuesday 23 August 2022

Hive: sign(n): Return the sign of a number

Signature

sign(n)

 

Return sign of a number. If the number is -ve, it return -1.0, for positive it return 1.0, 0.0 otherwise.

hive> SELECT sign(10);
OK
_c0
1.0
Time taken: 0.05 seconds, Fetched: 1 row(s)
hive> ;
hive> SELECT sign(-10);
OK
_c0
-1.0
Time taken: 0.041 seconds, Fetched: 1 row(s)
hive> ;
hive> SELECT sign(0);
OK
_c0
0.0
Time taken: 0.041 seconds, Fetched: 1 row(s)

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment