Jaa


zstd_decompress function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 15.2 and later

Returns value decompressed with Zstandard compression. On decompression failure, it throws an exception.

Syntax

zstd_decompress ( value )

Arguments

  • value: The binary value compressed with Zstandard that needs to be decompressed.

Returns

Decompressed value of type BINARY.

If value is not a valid ZSTD compressed value, Databricks raises INVALID_PARAMETER_VALUE.ZSTD_DECOMPRESS_INPUT. To return NULL instead of raising an exception, use the try_zstd_decompress function.

Examples

> SELECT string(zstd_decompress(unbase64("KLUv/SCCpQAAaEFwYWNoZSBTcGFyayABABLS+QU=")));
  Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark Apache Spark
> SELECT string(zstd_decompress(zstd_compress("Apache Spark")));
  Apache Spark
> SELECT zstd_decompress("invalid input")
  [INVALID_PARAMETER_VALUE.ZSTD_DECOMPRESS_INPUT] The value of parameter(s) `input` in `zstd_decompress` is invalid: expects valid zstd-compressed data. SQLSTATE: 22023