zstd_decompress
function
Applies to: Databricks SQL Databricks Runtime 15.2 and later
Returns value decompressed with Zstandard compression. On decompression failure, it throws an exception.
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