Skip to content

Commit 5bbb822

Browse files
committed
UDWF isn't a proper abstract base class right now since users can opt in to all methods
1 parent 62ec30d commit 5bbb822

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ ignore = [
113113
"PLW2901",
114114
"RET503",
115115
"RUF015",
116-
"TC001",
116+
"ANN101",
117117
]
118118

119119
[tool.ruff.lint.pydocstyle]

python/datafusion/udf.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Expr:
429429
return _decorator(*args, **kwargs)
430430

431431

432-
class WindowEvaluator(metaclass=ABCMeta):
432+
class WindowEvaluator:
433433
"""Evaluator class for user-defined window functions (UDWF).
434434
435435
It is up to the user to decide which evaluate function is appropriate.
@@ -447,7 +447,7 @@ class WindowEvaluator(metaclass=ABCMeta):
447447
+------------------------+--------------------------------+------------------+---------------------------+
448448
""" # noqa: W505, E501
449449

450-
def memoize(self) -> None: # noqa: B027
450+
def memoize(self) -> None:
451451
"""Perform a memoize operation to improve performance.
452452
453453
When the window frame has a fixed beginning (e.g UNBOUNDED
@@ -481,7 +481,7 @@ def is_causal(self) -> bool:
481481
"""Get whether evaluator needs future data for its result."""
482482
return False
483483

484-
def evaluate_all(self, values: list[pa.Array], num_rows: int) -> pa.Array: # noqa: B027
484+
def evaluate_all(self, values: list[pa.Array], num_rows: int) -> pa.Array:
485485
"""Evaluate a window function on an entire input partition.
486486
487487
This function is called once per input *partition* for window functions that
@@ -525,7 +525,7 @@ def evaluate_all(self, values: list[pa.Array], num_rows: int) -> pa.Array: # no
525525
avg(x) OVER (PARTITION BY y ORDER BY z ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING)
526526
""" # noqa: W505, E501
527527

528-
def evaluate( # noqa: B027
528+
def evaluate(
529529
self, values: list[pa.Array], eval_range: tuple[int, int]
530530
) -> pa.Scalar:
531531
"""Evaluate window function on a range of rows in an input partition.
@@ -543,7 +543,7 @@ def evaluate( # noqa: B027
543543
single argument, `values[1..]` will contain ORDER BY expression results.
544544
"""
545545

546-
def evaluate_all_with_rank( # noqa: B027
546+
def evaluate_all_with_rank(
547547
self, num_rows: int, ranks_in_partition: list[tuple[int, int]]
548548
) -> pa.Array:
549549
"""Called for window functions that only need the rank of a row.
@@ -575,12 +575,10 @@ def evaluate_all_with_rank( # noqa: B027
575575
The user must implement this method if ``include_rank`` returns True.
576576
"""
577577

578-
@abstractmethod
579578
def supports_bounded_execution(self) -> bool:
580579
"""Can the window function be incrementally computed using bounded memory?"""
581580
return False
582581

583-
@abstractmethod
584582
def uses_window_frame(self) -> bool:
585583
"""Does the window function use the values from the window frame?"""
586584
return False

0 commit comments

Comments
 (0)