xi-db commented on code in PR #46672:
URL: https://github.com/apache/spark/pull/46672#discussion_r2185475696
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala:
##########
@@ -561,4 +565,314 @@ case class TryAesDecrypt(
override protected def withNewChildInternal(newChild: Expression):
Expression =
this.copy(replacement = newChild)
}
+
+/**
+ * A function that compress input using Zstandard.
+ * If either argument is NULL, the return value is NULL.
+ */
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage = """
+ _FUNC_(expr[, level[, streaming_mode]]) - Returns a compressed value of
`expr` using Zstandard with the specified compression `level`.
+ The default level is 3. Uses single-pass mode by default.
+ """,
+ arguments = """
+ Arguments:
+ * expr - The binary value to compress.
+ * level - Optional integer argument that represents the compression
level. The compression level controls the trade-off between compression speed
and compression ratio.
+ Valid values: between 1 and 22 inclusive, where 1 means
fastest but lowest compression ratio, and 22 means slowest but highest
compression ratio.
+ The default level is 3 if not specified.
+ * streaming_mode - Optional boolean argument that represents whether to
use streaming mode. If true, the function will compress the input in streaming
mode.
+ The default value is false.
+ """,
+ examples = """
+ Examples:
+ > SELECT base64(_FUNC_(repeat("Apache Spark ", 10)));
+ KLUv/SCCpQAAaEFwYWNoZSBTcGFyayABABLS+QU=
+ > SELECT base64(_FUNC_(repeat("Apache Spark ", 10), 5));
+ KLUv/SCCpQAAaEFwYWNoZSBTcGFyayABABLS+QU=
+ > SELECT base64(_FUNC_(repeat("Apache Spark ", 10), 3, true));
+ KLUv/QBYpAAAaEFwYWNoZSBTcGFyayABABLS+QUBAAA=
+ """,
+ since = "4.0.0",
+ group = "misc_funcs")
+// scalastyle:on line.size.limit
+case class ZstdCompress(input: Expression, level: Expression, streamingMode:
Expression)
Review Comment:
Thanks for reviewing. Yes, will update.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]