Skip to content

Commit 55bb9b9

Browse files
committed
address comments
1 parent 09cdbbe commit 55bb9b9

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

bigframes/core/compile/sqlglot/aggregations/nullary_compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from bigframes.core import window_spec
2222
import bigframes.core.compile.sqlglot.aggregations.op_registration as reg
23-
from bigframes.core.compile.sqlglot.aggregations.window import apply_window_if_present
23+
from bigframes.core.compile.sqlglot.aggregations.windows import apply_window_if_present
2424
from bigframes.operations import aggregations as agg_ops
2525

2626
NULLARY_OP_REGISTRATION = reg.OpRegistration()

bigframes/core/compile/sqlglot/aggregations/unary_compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from bigframes.core import window_spec
2222
import bigframes.core.compile.sqlglot.aggregations.op_registration as reg
23-
from bigframes.core.compile.sqlglot.aggregations.window import apply_window_if_present
23+
from bigframes.core.compile.sqlglot.aggregations.windows import apply_window_if_present
2424
import bigframes.core.compile.sqlglot.expressions.typed_expr as typed_expr
2525
import bigframes.core.compile.sqlglot.sqlglot_ir as ir
2626
from bigframes.operations import aggregations as agg_ops

bigframes/core/compile/sqlglot/aggregations/window.py renamed to bigframes/core/compile/sqlglot/aggregations/windows.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def apply_window_if_present(
7676
start = window.bounds.start
7777
end = window.bounds.end
7878

79-
start_value, start_side = _get_window_bounds(start, is_start_bounds=True)
80-
end_value, end_side = _get_window_bounds(end, is_start_bounds=False)
79+
start_value, start_side = _get_window_bounds(start, is_preceding=True)
80+
end_value, end_side = _get_window_bounds(end, is_preceding=False)
8181

8282
spec = sge.WindowSpec(
8383
kind=kind,
@@ -139,11 +139,11 @@ def get_window_order_by(
139139

140140

141141
def _get_window_bounds(
142-
value, is_start_bounds: bool
142+
value, is_preceding: bool
143143
) -> tuple[typing.Union[str, sge.Expression], typing.Optional[str]]:
144144
"""Compiles a single boundary value into its SQL components."""
145145
if value is None:
146-
side = "PRECEDING" if is_start_bounds else "FOLLOWING"
146+
side = "PRECEDING" if is_preceding else "FOLLOWING"
147147
return "UNBOUNDED", side
148148

149149
if value == 0:

bigframes/core/compile/sqlglot/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from bigframes.core import expression, guid, identifiers, nodes, pyarrow_utils, rewrite
2424
from bigframes.core.compile import configs
2525
import bigframes.core.compile.sqlglot.aggregate_compiler as aggregate_compiler
26-
from bigframes.core.compile.sqlglot.aggregations import window
26+
from bigframes.core.compile.sqlglot.aggregations import windows
2727
from bigframes.core.compile.sqlglot.expressions import typed_expr
2828
import bigframes.core.compile.sqlglot.scalar_compiler as scalar_compiler
2929
import bigframes.core.compile.sqlglot.sqlglot_ir as ir
@@ -273,7 +273,7 @@ def compile_random_sample(
273273
def compile_aggregate(
274274
self, node: nodes.AggregateNode, child: ir.SQLGlotIR
275275
) -> ir.SQLGlotIR:
276-
ordering_cols = window.get_window_order_by(
276+
ordering_cols = windows.get_window_order_by(
277277
node.order_by, override_null_order=True
278278
)
279279
aggregations: tuple[tuple[str, sge.Expression], ...] = tuple(

tests/unit/core/compile/sqlglot/aggregations/test_window.py renamed to tests/unit/core/compile/sqlglot/aggregations/test_windows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import sqlglot.expressions as sge
2020

2121
from bigframes.core import window_spec
22-
from bigframes.core.compile.sqlglot.aggregations.window import (
22+
from bigframes.core.compile.sqlglot.aggregations.windows import (
2323
apply_window_if_present,
2424
get_window_order_by,
2525
)
2626
import bigframes.core.expression as ex
2727
import bigframes.core.ordering as ordering
2828

2929

30-
class WindowTest(unittest.TestCase):
30+
class WindowsTest(unittest.TestCase):
3131
def test_get_window_order_by_empty(self):
3232
self.assertIsNone(get_window_order_by(tuple()))
3333

0 commit comments

Comments
 (0)