[ https://issues.apache.org/jira/browse/FLINK-35993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dylan He updated FLINK-35993: ----------------------------- Description: Add UNHEX function. ---- Converts hexadecimal {{expr}} to BINARY. Example: {code:sql} > SELECT DECODE(UNHEX('466C696E6B'), 'UTF-8'); Flink {code} Syntax: {code:sql} UNHEX(expr) {code} Arguments: * {{expr}}: A STRING expression of hexadecimal characters. Returns: A BINARY. If the length of {{expr}} is odd, the first character is discarded and the result is left padded with a null byte. If {{expr}} contains non-hex characters, the result is NULL. See also: * [Spark|https://spark.apache.org/docs/3.5.1/sql-ref-functions-builtin.html#mathematical-functions] * [Databricks|https://docs.databricks.com/en/sql/language-manual/functions/unhex.html] * [MySQL|https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_unhex] * [PostgreSQL|https://www.postgresql.org/docs/16/functions-binarystring.html] decode(expr, 'hex') * [Snowflake|https://docs.snowflake.com/en/sql-reference/functions/hex_decode_binary] * [Calcite|https://calcite.apache.org/docs/reference.html] from_hex was: Add UNHEX function. ---- Converts hexadecimal {{expr}} to BINARY. Example: {code:sql} > SELECT DECODE(UNHEX('466C696E6B'), 'UTF-8'); Flink {code} Syntax: {code:sql} UNHEX(expr) {code} Arguments: * {{expr}}: A STRING expression of hexadecimal characters. Returns: A BINARY. If the length of {{expr}} is odd, or {{expr}} contains non hex characters, the function returns an error. See also: * [Spark|https://spark.apache.org/docs/3.5.1/sql-ref-functions-builtin.html#mathematical-functions] * [Databricks|https://docs.databricks.com/en/sql/language-manual/functions/unhex.html] * [MySQL|https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_unhex] * [PostgreSQL|https://www.postgresql.org/docs/16/functions-binarystring.html] decode(expr, 'hex') * [Snowflake|https://docs.snowflake.com/en/sql-reference/functions/hex_decode_binary] * [Calcite|https://calcite.apache.org/docs/reference.html] from_hex > Add UNHEX function > ------------------ > > Key: FLINK-35993 > URL: https://issues.apache.org/jira/browse/FLINK-35993 > Project: Flink > Issue Type: Sub-task > Components: Table SQL / API > Reporter: Dylan He > Priority: Major > Labels: pull-request-available > > Add UNHEX function. > ---- > Converts hexadecimal {{expr}} to BINARY. > Example: > {code:sql} > > SELECT DECODE(UNHEX('466C696E6B'), 'UTF-8'); > Flink > {code} > Syntax: > {code:sql} > UNHEX(expr) > {code} > Arguments: > * {{expr}}: A STRING expression of hexadecimal characters. > Returns: > A BINARY. > If the length of {{expr}} is odd, the first character is discarded and the > result is left padded with a null byte. > If {{expr}} contains non-hex characters, the result is NULL. > See also: > * > [Spark|https://spark.apache.org/docs/3.5.1/sql-ref-functions-builtin.html#mathematical-functions] > * > [Databricks|https://docs.databricks.com/en/sql/language-manual/functions/unhex.html] > * > [MySQL|https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_unhex] > * > [PostgreSQL|https://www.postgresql.org/docs/16/functions-binarystring.html] > decode(expr, 'hex') > * > [Snowflake|https://docs.snowflake.com/en/sql-reference/functions/hex_decode_binary] > * [Calcite|https://calcite.apache.org/docs/reference.html] from_hex -- This message was sent by Atlassian Jira (v8.20.10#820010)