You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by db...@apache.org on 2018/06/09 00:17:48 UTC
spark git commit: [SPARK-24412][SQL] Adding docs about automagical
type casting in `isin` and `isInCollection` APIs
Repository: spark
Updated Branches:
refs/heads/master f433ef786 -> 36a340913
[SPARK-24412][SQL] Adding docs about automagical type casting in `isin` and `isInCollection` APIs
## What changes were proposed in this pull request?
Update documentation for `isInCollection` API to clealy explain the "auto-casting" of elements if their types are different.
## How was this patch tested?
No-Op
Author: Thiruvasakan Paramasivan <th...@apple.com>
Closes #21519 from trvskn/sql-doc-update.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/36a34091
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/36a34091
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/36a34091
Branch: refs/heads/master
Commit: 36a3409134687d6a2894cd6a77554b8439cacec1
Parents: f433ef7
Author: Thiruvasakan Paramasivan <th...@apple.com>
Authored: Fri Jun 8 17:17:43 2018 -0700
Committer: DB Tsai <d_...@apple.com>
Committed: Fri Jun 8 17:17:43 2018 -0700
----------------------------------------------------------------------
.../scala/org/apache/spark/sql/Column.scala | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/36a34091/sql/core/src/main/scala/org/apache/spark/sql/Column.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/Column.scala b/sql/core/src/main/scala/org/apache/spark/sql/Column.scala
index b3e59f5..2dbb53e 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/Column.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/Column.scala
@@ -781,6 +781,14 @@ class Column(val expr: Expression) extends Logging {
* A boolean expression that is evaluated to true if the value of this expression is contained
* by the evaluated values of the arguments.
*
+ * Note: Since the type of the elements in the list are inferred only during the run time,
+ * the elements will be "up-casted" to the most common type for comparison.
+ * For eg:
+ * 1) In the case of "Int vs String", the "Int" will be up-casted to "String" and the
+ * comparison will look like "String vs String".
+ * 2) In the case of "Float vs Double", the "Float" will be up-casted to "Double" and the
+ * comparison will look like "Double vs Double"
+ *
* @group expr_ops
* @since 1.5.0
*/
@@ -791,6 +799,14 @@ class Column(val expr: Expression) extends Logging {
* A boolean expression that is evaluated to true if the value of this expression is contained
* by the provided collection.
*
+ * Note: Since the type of the elements in the collection are inferred only during the run time,
+ * the elements will be "up-casted" to the most common type for comparison.
+ * For eg:
+ * 1) In the case of "Int vs String", the "Int" will be up-casted to "String" and the
+ * comparison will look like "String vs String".
+ * 2) In the case of "Float vs Double", the "Float" will be up-casted to "Double" and the
+ * comparison will look like "Double vs Double"
+ *
* @group expr_ops
* @since 2.4.0
*/
@@ -800,6 +816,14 @@ class Column(val expr: Expression) extends Logging {
* A boolean expression that is evaluated to true if the value of this expression is contained
* by the provided collection.
*
+ * Note: Since the type of the elements in the collection are inferred only during the run time,
+ * the elements will be "up-casted" to the most common type for comparison.
+ * For eg:
+ * 1) In the case of "Int vs String", the "Int" will be up-casted to "String" and the
+ * comparison will look like "String vs String".
+ * 2) In the case of "Float vs Double", the "Float" will be up-casted to "Double" and the
+ * comparison will look like "Double vs Double"
+ *
* @group java_expr_ops
* @since 2.4.0
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org