Jaa


try_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, the function returns NULL

Syntax

try_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 returns NULL. To return an error instead of NULL, use the zstd_decompress function.

Examples

> SELECT string(try_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(try_zstd_decompress(zstd_compress("Apache Spark")));
  Apache Spark
> SELECT try_zstd_decompress("invalid input")
  NULL