What is the difference between rowsBetween and rangeBetween?

前端 未结 4 527
逝去的感伤
逝去的感伤 2020-12-13 10:04

From the PySpark docs rangeBetween:

rangeBetween(start, end)

Defines the frame boundaries, from start (inclusive) to end (inc

4条回答
  •  遥遥无期
    2020-12-13 10:26

    RANGEbetween looks at the ORDER BY clause to determine if a row is included in a window.

    ROWSbetween looks at the order of the rows.

    RANGE between checks if the ORDER BY is within some specified range, and will include them in a window.

    ROWSbetween will form your window based on what rows are positionally around your current row (irregardless of the value of the ORDER BY column for those rows)

提交回复
热议问题