इसके माध्यम से साझा किया गया


zstd_compress function

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

Returns value compressed with Zstandard compression.

Syntax

zstd_compress ( value [, level [, streaming_mode ] ] )

Arguments

  • value: The binary value to compress.
  • level: Optional integer argument between 1 and 22 that represents the compression level. The default is 3.
  • streaming_mode: Optional boolean argument that indicates whether to use streaming mode.

Returns

Compressed value of type BINARY.

Examples

> SELECT base64(zstd_compress(repeat("Apache Spark ", 10)));
  KLUv/SCCpQAAaEFwYWNoZSBTcGFyayABABLS+QU=
> SELECT string(zstd_decompress(zstd_compress("Apache Spark")));
  Apache Spark
-- Using streaming mode
> SELECT base64(zstd_compress(repeat("Apache Spark ", 10), 3, true));
  KLUv/QBYpAAAaEFwYWNoZSBTcGFyayABABLS+QUBAAA=