This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 47e8e02141d4 [SPARK-46243][SQL][DOCS] Describe arguments of `decode()`
47e8e02141d4 is described below
commit 47e8e02141d4f56f5cb92ec4762c9ea5c9b91e90
Author: Max Gekk <[email protected]>
AuthorDate: Tue Dec 5 08:31:49 2023 +0900
[SPARK-46243][SQL][DOCS] Describe arguments of `decode()`
### What changes were proposed in this pull request?
In the PR, I propose to update the description of the `StringDecode`
expression and apparently the `decode()` function by describing the arguments
`bin` and `charset`.
#### The updated docs:
<img width="743" alt="Screenshot 2023-12-04 at 12 24 36"
src="https://github.com/apache/spark/assets/1580697/a177f81d-2f39-45ff-bc28-b217dad4e128">
### Why are the changes needed?
To improve user experience with Spark SQL by documenting the public
function.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
By manually checking the generated docs.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #44157 from MaxGekk/doc-decode-params.
Authored-by: Max Gekk <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
.../sql/catalyst/expressions/stringExpressions.scala | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
index 7c5d65d2b958..259556826ad9 100755
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
@@ -2594,6 +2594,11 @@ object Decode {
the corresponding result. If no match is found, then it returns default.
If default
is omitted, it returns null.
""",
+ arguments = """
+ Arguments:
+ * bin - a binary expression to decode
+ * charset - one of the charsets 'US-ASCII', 'ISO-8859-1', 'UTF-8',
'UTF-16BE', 'UTF-16LE', 'UTF-16' to decode `bin` into a STRING. It is case
insensitive.
+ """,
examples = """
Examples:
> SELECT _FUNC_(encode('abc', 'utf-8'), 'utf-8');
@@ -2623,18 +2628,21 @@ case class Decode(params: Seq[Expression], replacement:
Expression)
}
/**
- * Decodes the first argument into a String using the provided character set
- * (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE',
'UTF-16').
- * If either argument is null, the result will also be null.
+ * Decodes the first argument into a String using the provided character set.
*/
// scalastyle:off line.size.limit
@ExpressionDescription(
- usage = "_FUNC_(bin, charset) - Decodes the first argument using the second
argument character set.",
+ usage = "_FUNC_(bin, charset) - Decodes the first argument using the second
argument character set. If either argument is null, the result will also be
null.",
examples = """
Examples:
> SELECT _FUNC_(encode('abc', 'utf-8'), 'utf-8');
abc
""",
+ arguments = """
+ Arguments:
+ * bin - a binary expression to decode
+ * charset - one of the charsets 'US-ASCII', 'ISO-8859-1', 'UTF-8',
'UTF-16BE', 'UTF-16LE', 'UTF-16' to decode `bin` into a STRING. It is case
insensitive.
+ """,
since = "1.5.0",
group = "string_funcs")
// scalastyle:on line.size.limit
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]