You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Rui Wang (JIRA)" <ji...@apache.org> on 2018/11/03 06:14:00 UTC

[jira] [Created] (BEAM-5962) TO_HEX

Rui Wang created BEAM-5962:
------------------------------

             Summary: TO_HEX
                 Key: BEAM-5962
                 URL: https://issues.apache.org/jira/browse/BEAM-5962
             Project: Beam
          Issue Type: Sub-task
          Components: dsl-sql
            Reporter: Rui Wang
            Assignee: Rui Wang


TO_HEX(bytes)

Converts a sequence of BYTES into a hexadecimal STRING. Converts each byte in the STRING as two hexadecimal characters in the range (0..9, a..f). To convert a hexadecimal-encoded STRING to BYTES, use FROM_HEX.

Return type

STRING

Example

WITH Input AS (
  SELECT b'\x00\x01\x02\x03\xAA\xEE\xEF\xFF' AS byte_str UNION ALL
  SELECT b'foobar'
)
SELECT byte_str, TO_HEX(byte_str) AS hex_str
FROM Input;
+----------------------------------+------------------+
| byte_string                      | hex_string       |
+----------------------------------+------------------+
| foobar                           | 666f6f626172     |
| \x00\x01\x02\x03\xaa\xee\xef\xff | 00010203aaeeefff |
+----------------------------------+------------------+



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)