|
24 | 24 |
|
25 | 25 | from typing import TYPE_CHECKING, Any, Optional |
26 | 26 |
|
27 | | -import pyarrow as pa |
28 | | - |
29 | 27 | try: |
30 | 28 | from warnings import deprecated # Python 3.13+ |
31 | 29 | except ImportError: |
@@ -1206,12 +1204,20 @@ def __init__( |
1206 | 1204 | will be set to unbounded. If unit type is ``groups``, this |
1207 | 1205 | parameter must be set. |
1208 | 1206 | """ |
1209 | | - if not isinstance(start_bound, pa.Scalar) and start_bound is not None: |
1210 | | - start_bound = pa.scalar(start_bound) |
| 1207 | + if start_bound is not None: |
| 1208 | + if not isinstance(start_bound, (pa.Array, pa.ChunkedArray)): |
| 1209 | + if isinstance(start_bound, pa.Scalar): |
| 1210 | + start_bound = pa.array([start_bound.as_py()]) |
| 1211 | + else: |
| 1212 | + start_bound = pa.array([start_bound]) |
1211 | 1213 | if units in ("rows", "groups"): |
1212 | 1214 | start_bound = start_bound.cast(pa.uint64()) |
1213 | | - if not isinstance(end_bound, pa.Scalar) and end_bound is not None: |
1214 | | - end_bound = pa.scalar(end_bound) |
| 1215 | + if end_bound is not None: |
| 1216 | + if not isinstance(end_bound, (pa.Array, pa.ChunkedArray)): |
| 1217 | + if isinstance(end_bound, pa.Scalar): |
| 1218 | + end_bound = pa.array([end_bound.as_py()]) |
| 1219 | + else: |
| 1220 | + end_bound = pa.array([end_bound]) |
1215 | 1221 | if units in ("rows", "groups"): |
1216 | 1222 | end_bound = end_bound.cast(pa.uint64()) |
1217 | 1223 | self.window_frame = expr_internal.WindowFrame(units, start_bound, end_bound) |
|
0 commit comments