Skip to content

Commit e6d6eaf

Browse files
deepyamanholdenk
authored andcommitted
[SPARK-26451][SQL] Change lead/lag argument name from count to offset
## What changes were proposed in this pull request? Change aligns argument name with that in Scala version and documentation. ## How was this patch tested? (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests) (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Please review http://spark.apache.org/contributing.html before opening a pull request. Closes apache#23357 from deepyaman/patch-1. Authored-by: deepyaman <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent b3032c9 commit e6d6eaf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

python/pyspark/sql/functions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def factorial(col):
798798
# --------------- Window functions ------------------------
799799

800800
@since(1.4)
801-
def lag(col, count=1, default=None):
801+
def lag(col, offset=1, default=None):
802802
"""
803803
Window function: returns the value that is `offset` rows before the current row, and
804804
`defaultValue` if there is less than `offset` rows before the current row. For example,
@@ -807,15 +807,15 @@ def lag(col, count=1, default=None):
807807
This is equivalent to the LAG function in SQL.
808808
809809
:param col: name of column or expression
810-
:param count: number of row to extend
810+
:param offset: number of row to extend
811811
:param default: default value
812812
"""
813813
sc = SparkContext._active_spark_context
814-
return Column(sc._jvm.functions.lag(_to_java_column(col), count, default))
814+
return Column(sc._jvm.functions.lag(_to_java_column(col), offset, default))
815815

816816

817817
@since(1.4)
818-
def lead(col, count=1, default=None):
818+
def lead(col, offset=1, default=None):
819819
"""
820820
Window function: returns the value that is `offset` rows after the current row, and
821821
`defaultValue` if there is less than `offset` rows after the current row. For example,
@@ -824,11 +824,11 @@ def lead(col, count=1, default=None):
824824
This is equivalent to the LEAD function in SQL.
825825
826826
:param col: name of column or expression
827-
:param count: number of row to extend
827+
:param offset: number of row to extend
828828
:param default: default value
829829
"""
830830
sc = SparkContext._active_spark_context
831-
return Column(sc._jvm.functions.lead(_to_java_column(col), count, default))
831+
return Column(sc._jvm.functions.lead(_to_java_column(col), offset, default))
832832

833833

834834
@since(1.4)

0 commit comments

Comments
 (0)