DECOMPRESS

更新时间:
复制 MD 格式

Decompresses a GZIP-compressed BINARY value and returns the result as a BINARY value.

Syntax

binary decompress(binary <bin>)

Parameters

bin: Required. The BINARY value to decompress.

Return value

Returns a value of the BINARY type. If bin is null, null is returned.

To get a readable string from the decompressed result, cast the output: CAST(decompress(...) AS STRING).

Examples

Example 1: Decompress the result of compressing the string hello, world, and convert the output to a string.

-- The return value is hello, world.
SELECT CAST(decompress(compress('hello, world')) AS STRING);

Example 2: The input parameter is null.

-- The return value is null.
SELECT decompress(null);

What's next

For other built-in functions in the same category, see Other functions.