Type / Encoding Functions

5 functions for hex/binary/base conversions, safe casting, and custom SQL expressions. The source column is always the implicit first input.

FunctionSyntaxParametersNotes
to_hexto_hex(column)None.
to_binaryto_binary(column)None.
base_convbase_conv(column, fromBase, toBase)fromBase default 10. toBase default 16.Spark conv().
try_casttry_cast(column, targetType, precision, scale)targetType — required. precision, scale — used for decimal.Null-safe cast — returns null on failure instead of raising an error.
custom_sqlcustom_sql(expression)expression — arbitrary Spark SQL expression string.Escape hatch for logic not covered by the built-in function catalog.