Skip to main content

WindowSpec class

A window specification that defines the partitioning, ordering, and frame boundaries.

Changed in Databricks Runtime 13.0: Supports Spark Connect.

Use the static methods in Window to create a WindowSpec.

Methods

Method

Description

orderBy(*cols)

Defines the ordering columns in a WindowSpec.

partitionBy(*cols)

Defines the partitioning columns in a WindowSpec.

rangeBetween(start, end)

Defines the frame boundaries, from start (inclusive) to end (inclusive), using range-based offsets from the current row's ORDER BY value.

rowsBetween(start, end)

Defines the frame boundaries, from start (inclusive) to end (inclusive), using row-based offsets from the current row.