[
https://issues.apache.org/jira/browse/SPARK-24371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
DB Tsai updated SPARK-24371:
----------------------------
Summary: Added isInCollection in DataFrame API for Scala and Java. (was:
Added isinSet in DataFrame API for Scala and Java.)
> Added isInCollection in DataFrame API for Scala and Java.
> ---------------------------------------------------------
>
> Key: SPARK-24371
> URL: https://issues.apache.org/jira/browse/SPARK-24371
> Project: Spark
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 2.3.0
> Reporter: DB Tsai
> Assignee: DB Tsai
> Priority: Major
> Fix For: 2.4.0
>
>
> Implemented *{{isinSet}}* in DataFrame API for both Scala and Java, so users
> can do
> {code}
> val profileDF = Seq(
> Some(1), Some(2), Some(3), Some(4),
> Some(5), Some(6), Some(7), None
> ).toDF("profileID")
> val validUsers: Set[Any] = Set(6, 7.toShort, 8L, "3")
> val result = profileDF.withColumn("isValid", $"profileID".isinSet(validUsers))
> result.show(10)
> """
> +----------+------+
> |profileID|isValid|
> +----------+------+
> |1|false|
> |2|false|
> |3|true|
> |4|false|
> |5|false|
> |6|true|
> |7|true|
> |null|null|
> +----------+------+
> """.stripMargin
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]