Hiveql - RIGHT() LEFT() Function

There is no right or left function but you can implement same with substr like

left (column, nchar) = substr(column, 1, nchar)

right  (column, nchar) = substr (column, (-1)* nchar)

Note: Here nchar is number of characters


This works for me for right function: substr (col, -nchar) = right(col, nchar).

hive> select substr('adbcefghij',-4);
ghij
Time taken: 40.839 seconds, Fetched: 1 row(s)

Hope this helps.


right(column, nchar) = substr(column, (length(column)-nchar+1), nchar)