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
1 2 3 4 5 |
isin(list: Any*): Column |
Internally, isin
creates a Column
with In predicate expression.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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| +---+---+---+ +---+---+---+ |