What's Missing
Six binary-typed function aliases registered in the Databend function registry have no documentation:
| Alias |
Primary function |
Input → Output |
HEX_ENCODE |
TO_HEX |
BINARY → STRING |
HEX_DECODE_BINARY |
FROM_HEX |
STRING → BINARY |
TRY_HEX_DECODE_BINARY |
TRY_FROM_HEX |
STRING → BINARY (NULL on error) |
BASE64_ENCODE |
TO_BASE64 |
BINARY → STRING |
BASE64_DECODE_BINARY |
FROM_BASE64 |
STRING → BINARY |
TRY_BASE64_DECODE_BINARY |
TRY_FROM_BASE64 |
STRING → BINARY (NULL on error) |
Source File
/workspace/databend/src/query/functions/src/scalars/binary.rs
Relevant registrations:
.scalar_builder("to_hex")
.aliases(&["hex", "hex_encode"]) // hex_encode: BINARY → STRING
.scalar_builder("from_hex")
.aliases(&["unhex", "hex_decode_binary"]) // hex_decode_binary: STRING → BINARY
registry.register_aliases("try_from_hex", &["try_hex_decode_binary"]);
.scalar_builder("to_base64")
.aliases(&["base64_encode"]) // base64_encode: BINARY → STRING
.scalar_builder("from_base64")
.aliases(&["base64_decode_binary"]) // base64_decode_binary: STRING → BINARY
registry.register_aliases("try_from_base64", &["try_base64_decode_binary"]);
What They Do
These are binary-typed overloads of the existing hex/base64 string functions. The key distinction from the string variants (HEX, UNHEX, TO_BASE64, FROM_BASE64) is that these aliases operate on or return the BINARY data type rather than STRING, making them useful when working with raw binary data.
HEX_ENCODE(binary) — hex-encodes a BINARY value to a hex STRING
HEX_DECODE_BINARY(string) — decodes a hex STRING to BINARY; throws on invalid input
TRY_HEX_DECODE_BINARY(string) — same as above but returns NULL on error
BASE64_ENCODE(binary) — base64-encodes a BINARY value to a STRING
BASE64_DECODE_BINARY(string) — decodes a base64 STRING to BINARY; throws on invalid input
TRY_BASE64_DECODE_BINARY(string) — same as above but returns NULL on error
Suggested Doc Location
These aliases should be mentioned in the existing docs for their primary functions:
HEX_ENCODE → /docs/en/sql-reference/20-sql-functions/06-string-functions/hex.md or the conversion to-hex.md
HEX_DECODE_BINARY / TRY_HEX_DECODE_BINARY → /docs/en/sql-reference/20-sql-functions/06-string-functions/from-hex.md
BASE64_ENCODE → /docs/en/sql-reference/20-sql-functions/06-string-functions/to-base64.md
BASE64_DECODE_BINARY / TRY_BASE64_DECODE_BINARY → /docs/en/sql-reference/20-sql-functions/06-string-functions/from-base64.md
What's Missing
Six binary-typed function aliases registered in the Databend function registry have no documentation:
HEX_ENCODETO_HEXBINARY → STRINGHEX_DECODE_BINARYFROM_HEXSTRING → BINARYTRY_HEX_DECODE_BINARYTRY_FROM_HEXSTRING → BINARY(NULL on error)BASE64_ENCODETO_BASE64BINARY → STRINGBASE64_DECODE_BINARYFROM_BASE64STRING → BINARYTRY_BASE64_DECODE_BINARYTRY_FROM_BASE64STRING → BINARY(NULL on error)Source File
/workspace/databend/src/query/functions/src/scalars/binary.rsRelevant registrations:
What They Do
These are binary-typed overloads of the existing hex/base64 string functions. The key distinction from the string variants (
HEX,UNHEX,TO_BASE64,FROM_BASE64) is that these aliases operate on or return theBINARYdata type rather thanSTRING, making them useful when working with raw binary data.HEX_ENCODE(binary)— hex-encodes aBINARYvalue to a hexSTRINGHEX_DECODE_BINARY(string)— decodes a hexSTRINGtoBINARY; throws on invalid inputTRY_HEX_DECODE_BINARY(string)— same as above but returnsNULLon errorBASE64_ENCODE(binary)— base64-encodes aBINARYvalue to aSTRINGBASE64_DECODE_BINARY(string)— decodes a base64STRINGtoBINARY; throws on invalid inputTRY_BASE64_DECODE_BINARY(string)— same as above but returnsNULLon errorSuggested Doc Location
These aliases should be mentioned in the existing docs for their primary functions:
HEX_ENCODE→/docs/en/sql-reference/20-sql-functions/06-string-functions/hex.mdor the conversionto-hex.mdHEX_DECODE_BINARY/TRY_HEX_DECODE_BINARY→/docs/en/sql-reference/20-sql-functions/06-string-functions/from-hex.mdBASE64_ENCODE→/docs/en/sql-reference/20-sql-functions/06-string-functions/to-base64.mdBASE64_DECODE_BINARY/TRY_BASE64_DECODE_BINARY→/docs/en/sql-reference/20-sql-functions/06-string-functions/from-base64.md