Hiveql - RIGHT() LEFT() Function

jmich738 picture jmich738 · Jan 3, 2017 · Viewed 47.5k times · Source

Is there a function in Hiveql that is equivalent to Right() or Left() fuction form TSQL? For example, RIGHT(col1,10) to get the first 10 characters from col1.

thank you

Answer

sandeep rawat picture sandeep rawat · Jan 3, 2017

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