Skip to content

Commit 850ea41

Browse files
committed
fix mypy
1 parent 6222c5e commit 850ea41

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bigframes/core/compile/compiled.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,11 @@ def _ibis_window_from_spec(self, window_spec: WindowSpec):
548548
window_spec.ordering,
549549
)
550550
else:
551-
order_by = _convert_range_ordering_to_table_value(
552-
self._column_names, window_spec.ordering[0]
553-
)
551+
order_by = [
552+
_convert_range_ordering_to_table_value(
553+
self._column_names, window_spec.ordering[0]
554+
)
555+
]
554556

555557
window = bigframes_vendored.ibis.window(order_by=order_by, group_by=group_by)
556558
if window_spec.bounds is not None:
@@ -611,8 +613,8 @@ def _convert_range_ordering_to_table_value(
611613
)
612614

613615
if ordering_column.direction.is_ascending:
614-
return bigframes_vendored.ibis.asc(expr)
615-
return bigframes_vendored.ibis.desc(expr)
616+
return bigframes_vendored.ibis.asc(expr) # type: ignore
617+
return bigframes_vendored.ibis.desc(expr) # type: ignore
616618

617619

618620
def _string_cast_join_cond(

bigframes/core/compile/polars/compiler.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import dataclasses
1717
import functools
1818
import itertools
19-
from typing import cast, Optional, Sequence, Tuple, TYPE_CHECKING, Union
19+
from typing import cast, Optional, Sequence, Tuple, TYPE_CHECKING
2020

2121
import bigframes.core
2222
from bigframes.core import window_spec
@@ -360,6 +360,7 @@ def compile_window(self, node: nodes.WindowOpNode):
360360
return df.with_columns([agg_expr])
361361

362362
else: # row-bounded window
363+
assert isinstance(window.bounds, window_spec.RowsWindowBounds)
363364
# Polars API semi-bounded, and any grouped rolling window challenging
364365
# https://github.com/pola-rs/polars/issues/4799
365366
# https://github.com/pola-rs/polars/issues/8976
@@ -383,9 +384,7 @@ def compile_window(self, node: nodes.WindowOpNode):
383384
return pl.concat([df, results], how="horizontal")
384385

385386

386-
def _get_period(
387-
bounds: Union[window_spec.RowsWindowBounds, window_spec.RangeWindowBounds]
388-
) -> Optional[int]:
387+
def _get_period(bounds: window_spec.RowsWindowBounds) -> Optional[int]:
389388
"""Returns None if the boundary is infinite."""
390389
if bounds.start is None or bounds.end is None:
391390
return None

0 commit comments

Comments
 (0)