@@ -49,6 +49,8 @@ class Window(object):
49
49
50
50
_JAVA_MIN_LONG = - (1 << 63 ) # -9223372036854775808
51
51
_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 )
52
54
53
55
unboundedPreceding = _JAVA_MIN_LONG
54
56
@@ -98,9 +100,9 @@ def rowsBetween(start, end):
98
100
The frame is unbounded if this is ``Window.unboundedFollowing``, or
99
101
any value greater than or equal to 9223372036854775807.
100
102
"""
101
- if start <= Window ._JAVA_MIN_LONG :
103
+ if start <= Window ._PRECEDING_THRESHOLD :
102
104
start = Window .unboundedPreceding
103
- if end >= Window ._JAVA_MAX_LONG :
105
+ if end >= Window ._FOLLOWING_THRESHOLD :
104
106
end = Window .unboundedFollowing
105
107
sc = SparkContext ._active_spark_context
106
108
jspec = sc ._jvm .org .apache .spark .sql .expressions .Window .rowsBetween (start , end )
@@ -123,14 +125,14 @@ def rangeBetween(start, end):
123
125
124
126
:param start: boundary start, inclusive.
125
127
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) .
127
129
:param end: boundary end, inclusive.
128
130
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) .
130
132
"""
131
- if start <= Window ._JAVA_MIN_LONG :
133
+ if start <= Window ._PRECEDING_THRESHOLD :
132
134
start = Window .unboundedPreceding
133
- if end >= Window ._JAVA_MAX_LONG :
135
+ if end >= Window ._FOLLOWING_THRESHOLD :
134
136
end = Window .unboundedFollowing
135
137
sc = SparkContext ._active_spark_context
136
138
jspec = sc ._jvm .org .apache .spark .sql .expressions .Window .rangeBetween (start , end )
@@ -185,14 +187,14 @@ def rowsBetween(self, start, end):
185
187
186
188
:param start: boundary start, inclusive.
187
189
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) .
189
191
:param end: boundary end, inclusive.
190
192
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) .
192
194
"""
193
- if start <= Window ._JAVA_MIN_LONG :
195
+ if start <= Window ._PRECEDING_THRESHOLD :
194
196
start = Window .unboundedPreceding
195
- if end >= Window ._JAVA_MAX_LONG :
197
+ if end >= Window ._FOLLOWING_THRESHOLD :
196
198
end = Window .unboundedFollowing
197
199
return WindowSpec (self ._jspec .rowsBetween (start , end ))
198
200
@@ -211,14 +213,14 @@ def rangeBetween(self, start, end):
211
213
212
214
:param start: boundary start, inclusive.
213
215
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) .
215
217
:param end: boundary end, inclusive.
216
218
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) .
218
220
"""
219
- if start <= Window ._JAVA_MIN_LONG :
221
+ if start <= Window ._PRECEDING_THRESHOLD :
220
222
start = Window .unboundedPreceding
221
- if end >= Window ._JAVA_MAX_LONG :
223
+ if end >= Window ._FOLLOWING_THRESHOLD :
222
224
end = Window .unboundedFollowing
223
225
return WindowSpec (self ._jspec .rangeBetween (start , end ))
224
226
0 commit comments