[ 
https://issues.apache.org/jira/browse/SPARK-24371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

DB Tsai resolved SPARK-24371.
-----------------------------
    Resolution: Fixed

> 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 *{{isInCollection}}* 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".isInCollection(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: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to