Rui Wang created BEAM-5956:
------------------------------
Summary: FROM_HEX
Key: BEAM-5956
URL: https://issues.apache.org/jira/browse/BEAM-5956
Project: Beam
Issue Type: Sub-task
Components: dsl-sql
Reporter: Rui Wang
Assignee: Rui Wang
FROM_HEX(string)
Converts a hexadecimal-encoded STRING into BYTES format. Returns an error if
the input STRING contains characters outside the range (0..9, A..F, a..f). The
lettercase of the characters does not matter. To convert BYTES to a
hexadecimal-encoded STRING, use TO_HEX.
Return type
BYTES
Example
WITH Input AS (
SELECT '00010203aaeeefff' AS hex_str UNION ALL
SELECT '0AF' UNION ALL
SELECT '666f6f626172'
)
SELECT hex_str, FROM_HEX(hex_str) AS bytes_str
FROM Input;
+------------------+----------------------------------+
| hex_str | bytes_str |
+------------------+----------------------------------+
| 0AF | \x00\xaf |
| 00010203aaeeefff | \x00\x01\x02\x03\xaa\xee\xef\xff |
| 666f6f626172 | foobar |
+------------------+----------------------------------+
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)