PostgreSQL and SparkSQL support defining the windowing behavior in the WINDOW clause and then referenced in OVER.
This is very useful if the same windowing behavior is wanted for several functions.
SELECT sum(salary) OVER w, avg(salary) OVER w
FROM empsalary
WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);