Skip to content

Commit 5c11465

Browse files
icexellossRobert Kruszewski
authored andcommitted
[SPARK-23861][SQL][DOC] Clarify default window frame with and without orderBy clause
## What changes were proposed in this pull request? Add docstring to clarify default window frame boundaries with and without orderBy clause ## How was this patch tested? Manually generate doc and check. Author: Li Jin <[email protected]> Closes apache#20978 from icexelloss/SPARK-23861-window-doc.
1 parent e98b553 commit 5c11465

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

python/pyspark/sql/window.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ class Window(object):
4444
>>> # PARTITION BY country ORDER BY date RANGE BETWEEN 3 PRECEDING AND 3 FOLLOWING
4545
>>> window = Window.orderBy("date").partitionBy("country").rangeBetween(-3, 3)
4646
47+
.. note:: When ordering is not defined, an unbounded window frame (rowFrame,
48+
unboundedPreceding, unboundedFollowing) is used by default. When ordering is defined,
49+
a growing window frame (rangeFrame, unboundedPreceding, currentRow) is used by default.
50+
4751
.. note:: Experimental
4852
4953
.. versionadded:: 1.4

sql/core/src/main/scala/org/apache/spark/sql/expressions/Window.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import org.apache.spark.sql.catalyst.expressions._
3333
* Window.partitionBy("country").orderBy("date").rowsBetween(-3, 3)
3434
* }}}
3535
*
36+
* @note When ordering is not defined, an unbounded window frame (rowFrame, unboundedPreceding,
37+
* unboundedFollowing) is used by default. When ordering is defined, a growing window frame
38+
* (rangeFrame, unboundedPreceding, currentRow) is used by default.
39+
*
3640
* @since 1.4.0
3741
*/
3842
@InterfaceStability.Stable

0 commit comments

Comments
 (0)