asc: Column
Column API — Column Operators
Column API is a set of operators to work with values in a column (of a Dataset).
Operator | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(New in 2.4.0) An expression operator that is
|
isin
Operator
isin(list: Any*): Column
Internally, isin
creates a Column
with In predicate expression.
val ids = Seq((1, 2, 2), (2, 3, 1)).toDF("x", "y", "id")
scala> ids.show
+---+---+---+
| x| y| id|
+---+---+---+
| 1| 2| 2|
| 2| 3| 1|
+---+---+---+
val c = $"id" isin ($"x", $"y")
val q = ids.filter(c)
scala> q.show
+---+---+---+
| x| y| id|
+---+---+---+
| 1| 2| 2|
+---+---+---+
// Note that isin accepts non-Column values
val c = $"id" isin ("x", "y")
val q = ids.filter(c)
scala> q.show
+---+---+---+
| x| y| id|
+---+---+---+
+---+---+---+