Binary Functions and Operators¶
Binary Operators¶
The || operator performs concatenation.
Binary Functions¶
- length(binary) -> bigint()
Returns the length of
binaryin bytes.
- concat(binary1, ..., binaryN) -> varbinary()
Returns the concatenation of
binary1,binary2,...,binaryN. This function provides the same functionality as the SQL-standard concatenation operator (||).
- substr(binary, start) -> varbinary()
Returns the rest of
binaryfrom the starting positionstart, measured in bytes. Positions start with1. A negative starting position is interpreted as being relative to the end of the string.
- substr(binary, start, length) -> varbinary()
Returns a substring from
binaryof lengthlengthfrom the starting positionstart, measured in bytes. Positions start with1. A negative starting position is interpreted as being relative to the end of the string.
- to_base64(binary) -> varchar()¶
Encodes
binaryinto a base64 string representation.
- from_base64(string) -> varbinary()¶
Decodes binary data from the base64 encoded
string.
- to_base64url(binary) -> varchar()¶
Encodes
binaryinto a base64 string representation using the URL safe alphabet.
- from_base64url(string) -> varbinary()¶
Decodes binary data from the base64 encoded
stringusing the URL safe alphabet.
- from_base32(string) -> varbinary()¶
Decodes binary data from the base32 encoded
string.
- to_base32(binary) -> varchar()¶
Encodes
binaryinto a base32 string representation.
- to_hex(binary) -> varchar()¶
Encodes
binaryinto a hex string representation.
- from_hex(string) -> varbinary()¶
Decodes binary data from the hex encoded
string.
- to_big_endian_64(bigint) -> varbinary()¶
Encodes
bigintin a 64-bit 2’s complement big endian format.
- from_big_endian_64(binary) -> bigint()¶
Decodes
bigintvalue from a 64-bit 2’s complement big endianbinary.
- to_big_endian_32(integer) -> varbinary()¶
Encodes
integerin a 32-bit 2’s complement big endian format.
- from_big_endian_32(binary) -> integer()¶
Decodes
integervalue from a 32-bit 2’s complement big endianbinary.
- to_ieee754_32(real) -> varbinary()¶
Encodes
realin a 32-bit big-endian binary according to IEEE 754 single-precision floating-point format.
- from_ieee754_32(binary) -> real()¶
Decodes the 32-bit big-endian
binaryin IEEE 754 single-precision floating-point format.
- to_ieee754_64(double) -> varbinary()¶
Encodes
doublein a 64-bit big-endian binary according to IEEE 754 double-precision floating-point format.
- from_ieee754_64(binary) -> double()¶
Decodes the 64-bit big-endian
binaryin IEEE 754 double-precision floating-point format.
- lpad(binary, size, padbinary) -> varbinary()
Left pads
binarytosizebytes withpadbinary. Ifsizeis less than the length ofbinary, the result is truncated tosizecharacters.sizemust not be negative andpadbinarymust be non-empty.
- rpad(binary, size, padbinary) -> varbinary()
Right pads
binarytosizebytes withpadbinary. Ifsizeis less than the length ofbinary, the result is truncated tosizecharacters.sizemust not be negative andpadbinarymust be non-empty.
- crc32(binary) -> bigint()¶
Computes the CRC-32 of
binary. For general purpose hashing, usexxhash64(), as it is much faster and produces a better quality hash.
- md5(binary) -> varbinary()¶
Computes the md5 hash of
binary.
- murmur3_x64_128(binary) -> varbinary()¶
Computes a hash of
binarythat is equivalent to C++ MurmurHash3_x64_128 (Murmur3F) of the samebinary.
- sha1(binary) -> varbinary()¶
Computes the sha1 hash of
binary.
- sha256(binary) -> varbinary()¶
Computes the sha256 hash of
binary.
- sha512(binary) -> varbinary()¶
Computes the sha512 hash of
binary.
- xxhash64(binary) -> varbinary()¶
Computes the xxhash64 hash of
binary.
- spooky_hash_v2_32(binary) -> varbinary()¶
Computes the 32-bit SpookyHashV2 hash of
binary.
- spooky_hash_v2_64(binary) -> varbinary()¶
Computes the 64-bit SpookyHashV2 hash of
binary.
- hmac_md5(binary, key) -> varbinary()¶
Computes HMAC with md5 of
binarywith the givenkey.
- hmac_sha1(binary, key) -> varbinary()¶
Computes HMAC with sha1 of
binarywith the givenkey.
- hmac_sha256(binary, key) -> varbinary()¶
Computes HMAC with sha256 of
binarywith the givenkey.
- hmac_sha512(binary, key) -> varbinary()¶
Computes HMAC with sha512 of
binarywith the givenkey.
- reverse(binary) -> varbinary()
Returns
binarywith the bytes in reverse order.