Hive: Convert String to Integer

Srinivas picture Srinivas · Sep 10, 2012 · Viewed 197.7k times · Source

I am looking for a Built-in UDF to convert values of a string column to integer in my hive table for sorting using SELECT and ORDER BY. I searched in the Language Manual, but no use. Any other suggestions also welcome.

Answer

Joe K picture Joe K · Sep 10, 2012

cast(str_column as int)

From: Language manual UDFs - type conversion functions