Accepts a FixedString(16) value and returns a string in text format containing 36 characters.
Syntax
UUIDNumToString(FixedString(16))
Parameter
Return value
Example
SELECT'a/<@];!~p{jTj={)' AS bytes, UUIDNumToString(toFixedString(bytes, 16)) AS uuid
┌─bytes────────────┬─uuid─────────────────────────────────┐ │ a/<@];!~p{jTj={) │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ └──────────────────┴──────────────────────────────────────┘
Accepts a string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx containing 36 characters, and returns it as a sequence of bytes in FixedString(16).
Syntax
UUIDStringToNum(String)
Parameter
Return value
Example
SELECT'612f3c40-5d3b-217e-707b-6a546a3d7b29' AS uuid, UUIDStringToNum(uuid) AS bytes
┌─uuid─────────────────────────────────┬─bytes────────────┐ │ 612f3c40-5d3b-217e-707b-6a546a3d7b29 │ a/<@];!~p{jTj={) │ └──────────────────────────────────────┴──────────────────┘
Accepts an integer. Returns an array of UInt64 numbers containing a list of powers of 2 that sum to the source number. The numbers in the array are arranged in ascending order.
Syntax
bitmaskToArray(num)
Parameter
num – an integerReturn value
Example
SELECT bitmaskToArray(1), bitmaskToArray(3), bitmaskToArray(4)
┌─bitmaskToArray(1)─┬─bitmaskToArray(3)─┬─bitmaskToArray(4)─┐ │ [1] │ [1, 2] │ [4] │ └───────────────────┴───────────────────┴───────────────────┘
1 = power(2,0)
3 = power(2,0) + power(2,1)
4 = power(2,2)
Accepts an integer. Returns a string containing a list of powers of 2 that sum to the source number. The numbers are separated by commas in text format, with no spaces, and are arranged in ascending order.
Syntax
bitmaskToList(num)
Parameter
num – an integerReturn value
Example
SELECT bitmaskToList(1), bitmaskToList(3), bitmaskToList(4)
┌─bitmaskToList(1)─┬─bitmaskToList(3)─┬─bitmaskToList(4)─┐ │ 1 │ 1,2 │ 4 │ └──────────────────┴──────────────────┴──────────────────┘
1 = power(2,0)
3 = power(2,0) + power(2,1)
4 = power(2,2)
Returns a string containing the hexadecimal representation of the parameter.
Syntax
hex(arg)
This function uses uppercase letters A-F, and does not use any prefix (such as 0x) or suffix (such as h).
For integer parameters, it prints hexadecimal digits ("nibbles") from the most significant to the least significant (big-endian or "human-readable" order). It starts from the most significant non-zero byte (leading zero bytes are omitted), but always prints two digits for each byte, even if the leading digit is zero.Date and DateTime type values are formatted as the corresponding integer (Date as the number of days since the epoch, DateTime as the value of the Unix timestamp).
For String and FixedString, all bytes are simply encoded as two hexadecimal digits each. Zero bytes are not omitted.