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/08 22:18:00 UTC

[jira] [Closed] (BEAM-5956) FROM_HEX

     [ https://issues.apache.org/jira/browse/BEAM-5956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rui Wang closed BEAM-5956.
--------------------------
       Resolution: Done
    Fix Version/s: Not applicable

> 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
>            Priority: Major
>             Fix For: Not applicable
>
>
> 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)