Getting started
User guides
Administration guides
Reference guides
Resources
Updated Aug 12, 2022
Send us feedback
decode
Translates binary expr to a string using the character set encoding charSet.
expr
charSet
decode(expr, charSet)
expr: A BINARY expression encoded in charset.
charset
charSet: A STRING expression.
A STRING.
If charSet does not match the encoding the result is undefined. charSet must be one of (case insensitive):
‘US-ASCII’
‘ISO-8859-1’
‘UTF-8’
‘UTF-16BE’
‘UTF-16LE’
‘UTF-16’
> SELECT encode('Spark SQL', 'UTF-16'); [FE FF 00 53 00 70 00 61 00 72 00 6B 00 20 00 53 00 51 00 4C] > SELECT decode(X'FEFF0053007000610072006B002000530051004C', 'UTF-16') Spark SQL
encode function
decode function