Skip to content

Column

over

over(): Column // (1)!
over(
  window: expressions.WindowSpec): Column
  1. Uses an empty WindowSpec

over creates a windowing column (analytic clause) for executing an aggregate window function over the given window (as a WindowSpec).


Internally, over requests the given WindowSpec to withAggregate with this Column.

val overUnspecifiedFrame = $"someColumn".over()
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.expressions.WindowSpec

val spec: WindowSpec = Window.rangeBetween(Window.unboundedPreceding, Window.currentRow)
val overRange = $"someColumn" over spec
scala> overRange
overRange: org.apache.spark.sql.Column = someColumn OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)