@@ -49,6 +49,8 @@ class Window(object):
4949
5050 _JAVA_MIN_LONG = - (1 << 63 ) # -9223372036854775808
5151 _JAVA_MAX_LONG = (1 << 63 ) - 1 # 9223372036854775807
52+ _PRECEDING_THRESHOLD = max (- sys .maxsize , _JAVA_MIN_LONG )
53+ _FOLLOWING_THRESHOLD = min (sys .maxsize , _JAVA_MAX_LONG )
5254
5355 unboundedPreceding = _JAVA_MIN_LONG
5456
@@ -98,9 +100,9 @@ def rowsBetween(start, end):
98100 The frame is unbounded if this is ``Window.unboundedFollowing``, or
99101 any value greater than or equal to 9223372036854775807.
100102 """
101- if start <= Window ._JAVA_MIN_LONG :
103+ if start <= Window ._PRECEDING_THRESHOLD :
102104 start = Window .unboundedPreceding
103- if end >= Window ._JAVA_MAX_LONG :
105+ if end >= Window ._FOLLOWING_THRESHOLD :
104106 end = Window .unboundedFollowing
105107 sc = SparkContext ._active_spark_context
106108 jspec = sc ._jvm .org .apache .spark .sql .expressions .Window .rowsBetween (start , end )
@@ -123,14 +125,14 @@ def rangeBetween(start, end):
123125
124126 :param start: boundary start, inclusive.
125127 The frame is unbounded if this is ``Window.unboundedPreceding``, or
126- any value less than or equal to - 9223372036854775808.
128+ any value less than or equal to max(-sys.maxsize, - 9223372036854775808) .
127129 :param end: boundary end, inclusive.
128130 The frame is unbounded if this is ``Window.unboundedFollowing``, or
129- any value greater than or equal to 9223372036854775807.
131+ any value greater than or equal to min(sys.maxsize, 9223372036854775807) .
130132 """
131- if start <= Window ._JAVA_MIN_LONG :
133+ if start <= Window ._PRECEDING_THRESHOLD :
132134 start = Window .unboundedPreceding
133- if end >= Window ._JAVA_MAX_LONG :
135+ if end >= Window ._FOLLOWING_THRESHOLD :
134136 end = Window .unboundedFollowing
135137 sc = SparkContext ._active_spark_context
136138 jspec = sc ._jvm .org .apache .spark .sql .expressions .Window .rangeBetween (start , end )
@@ -185,14 +187,14 @@ def rowsBetween(self, start, end):
185187
186188 :param start: boundary start, inclusive.
187189 The frame is unbounded if this is ``Window.unboundedPreceding``, or
188- any value less than or equal to - 9223372036854775808.
190+ any value less than or equal to max(-sys.maxsize, - 9223372036854775808) .
189191 :param end: boundary end, inclusive.
190192 The frame is unbounded if this is ``Window.unboundedFollowing``, or
191- any value greater than or equal to 9223372036854775807.
193+ any value greater than or equal to min(sys.maxsize, 9223372036854775807) .
192194 """
193- if start <= Window ._JAVA_MIN_LONG :
195+ if start <= Window ._PRECEDING_THRESHOLD :
194196 start = Window .unboundedPreceding
195- if end >= Window ._JAVA_MAX_LONG :
197+ if end >= Window ._FOLLOWING_THRESHOLD :
196198 end = Window .unboundedFollowing
197199 return WindowSpec (self ._jspec .rowsBetween (start , end ))
198200
@@ -211,14 +213,14 @@ def rangeBetween(self, start, end):
211213
212214 :param start: boundary start, inclusive.
213215 The frame is unbounded if this is ``Window.unboundedPreceding``, or
214- any value less than or equal to - 9223372036854775808.
216+ any value less than or equal to max(-sys.maxsize, - 9223372036854775808) .
215217 :param end: boundary end, inclusive.
216218 The frame is unbounded if this is ``Window.unboundedFollowing``, or
217- any value greater than or equal to 9223372036854775807.
219+ any value greater than or equal to min(sys.maxsize, 9223372036854775807) .
218220 """
219- if start <= Window ._JAVA_MIN_LONG :
221+ if start <= Window ._PRECEDING_THRESHOLD :
220222 start = Window .unboundedPreceding
221- if end >= Window ._JAVA_MAX_LONG :
223+ if end >= Window ._FOLLOWING_THRESHOLD :
222224 end = Window .unboundedFollowing
223225 return WindowSpec (self ._jspec .rangeBetween (start , end ))
224226
0 commit comments