You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ge...@apache.org on 2022/04/07 17:11:02 UTC
[spark] branch master updated: [SPARK-38818][DOC] Fix the docs of try_multiply/try_subtract/ANSI cast
This is an automated email from the ASF dual-hosted git repository.
gengliang 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 26428fe812b [SPARK-38818][DOC] Fix the docs of try_multiply/try_subtract/ANSI cast
26428fe812b is described below
commit 26428fe812bd5600a61c4d4efc4dcb0f32646222
Author: Gengliang Wang <ge...@apache.org>
AuthorDate: Fri Apr 8 01:10:13 2022 +0800
[SPARK-38818][DOC] Fix the docs of try_multiply/try_subtract/ANSI cast
### What changes were proposed in this pull request?
- Fix the valid combinations of ANSI CAST: Numeric types can be cast as Timestamp instead of Interval.
- Fix the usage of try_multiply/try_subtract, from `expr1 FUNC expr2` to `FUNC(expr1< expr2)`
### Why are the changes needed?
Fix wrong documention.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Preview:
<img width="874" alt="image" src="https://user-images.githubusercontent.com/1097932/162204348-5bfa66de-83b6-4732-b854-31b0999c5cc2.png">
Closes #36099 from gengliangwang/fixDoc.
Authored-by: Gengliang Wang <ge...@apache.org>
Signed-off-by: Gengliang Wang <ge...@apache.org>
---
docs/sql-ref-ansi-compliance.md | 2 +-
.../scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/sql-ref-ansi-compliance.md b/docs/sql-ref-ansi-compliance.md
index 0f7dd5df041..0f7f29cde7f 100644
--- a/docs/sql-ref-ansi-compliance.md
+++ b/docs/sql-ref-ansi-compliance.md
@@ -81,7 +81,7 @@ Besides, the ANSI SQL mode disallows the following type conversions which are al
| Source\Target | Numeric | String | Date | Timestamp | Interval | Boolean | Binary | Array | Map | Struct |
|-----------|---------|--------|------|-----------|----------|---------|--------|-------|-----|--------|
-| Numeric | <span style="color:red">**Y**</span> | Y | N | N | <span style="color:red">**Y**</span> | Y | N | N | N | N |
+| Numeric | <span style="color:red">**Y**</span> | Y | N | <span style="color:red">**Y**</span> | N | Y | N | N | N | N |
| String | <span style="color:red">**Y**</span> | Y | <span style="color:red">**Y**</span> | <span style="color:red">**Y**</span> | <span style="color:red">**Y**</span> | <span style="color:red">**Y**</span> | Y | N | N | N |
| Date | N | Y | Y | Y | N | N | N | N | N | N |
| Timestamp | <span style="color:red">**Y**</span> | Y | Y | Y | N | N | N | N | N | N |
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala
index 589e5801424..c179c83befb 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala
@@ -123,7 +123,7 @@ case class TryDivide(left: Expression, right: Expression, replacement: Expressio
}
@ExpressionDescription(
- usage = "expr1 _FUNC_ expr2 - Returns `expr1`-`expr2` and the result is null on overflow. " +
+ usage = "_FUNC_(expr1, expr2) - Returns `expr1`-`expr2` and the result is null on overflow. " +
"The acceptable input types are the same with the `-` operator.",
examples = """
Examples:
@@ -156,7 +156,7 @@ case class TrySubtract(left: Expression, right: Expression, replacement: Express
}
@ExpressionDescription(
- usage = "expr1 _FUNC_ expr2 - Returns `expr1`*`expr2` and the result is null on overflow. " +
+ usage = "_FUNC_(expr1, expr2) - Returns `expr1`*`expr2` and the result is null on overflow. " +
"The acceptable input types are the same with the `*` operator.",
examples = """
Examples:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org