Window Utility Object — Defining Window Specification
Window
utility object is a set of static methods to define a window specification.
Method | Description | ||
---|---|---|---|
|
Value representing the current row that is used to define frame boundaries. |
||
|
Creates a WindowSpec with the ordering defined. |
||
|
Creates a WindowSpec with the partitioning defined. |
||
|
Creates a WindowSpec with the frame boundaries defined, from |
||
|
Creates a WindowSpec with the frame boundaries defined, from |
||
|
Value representing the last row in a partition (equivalent to “UNBOUNDED FOLLOWING” in SQL) that is used to define frame boundaries. |
||
|
Value representing the first row in a partition (equivalent to “UNBOUNDED PRECEDING” in SQL) that is used to define frame boundaries. |
1 2 3 4 5 6 7 8 9 10 11 12 |
import org.apache.spark.sql.expressions.Window import org.apache.spark.sql.functions.{currentRow, lit} val windowSpec = Window .partitionBy($"orderId") .orderBy($"time") .rangeBetween(currentRow, lit(1)) scala> :type windowSpec org.apache.spark.sql.expressions.WindowSpec |
Creating “Empty” WindowSpec — spec
Internal Method
1 2 3 4 5 |
spec: WindowSpec |
spec
creates an “empty” WindowSpec, i.e. with empty partition and ordering specifications, and a UnspecifiedFrame
.
Note
|
|