try_cast


try_cast(ANY src, const string typeName) – Explicitly cast a value as a type. Returns null if cast fails.

SELECT try_cast(array(1.0,2.0,3.0), ‘array‘)
SELECT try_cast(map(‘A’,10,’B’,20,’C’,30), ‘map‘)

Platforms: WhereOS, Spark, Hive
Class: hivemall.tools.TryCastUDF

More functions can be added to WhereOS via Python or R bindings or as Java & Scala UDF (user-defined function), UDAF (user-defined aggregation function) and UDTF (user-defined table generating function) extensions. Custom libraries can be added on via Settings-page or installed from WhereOS Store.

Leave a Reply