Skip to content

Commit 462ddf4

Browse files
committed
Refactor range_table return type to DataFrame for improved type hinting
1 parent a860956 commit 462ddf4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

python/datafusion/_testing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
exposed as part of the public API. Keep the implementation minimal and
55
documented so reviewers can easily see it's test-only.
66
"""
7+
78
from __future__ import annotations
89

9-
from typing import Any
10+
from typing import TYPE_CHECKING
1011

1112
from .context import SessionContext
1213

14+
if TYPE_CHECKING:
15+
from datafusion import DataFrame
16+
1317

1418
def range_table(
1519
ctx: SessionContext,
1620
start: int,
1721
stop: int | None = None,
1822
step: int = 1,
1923
partitions: int | None = None,
20-
) -> Any:
24+
) -> DataFrame:
2125
"""Create a DataFrame containing a sequence of numbers using SQL RANGE.
2226
2327
This mirrors the previous ``SessionContext.range`` convenience method but
@@ -38,5 +42,5 @@ def range_table(
3842
start, stop = 0, start
3943

4044
parts = f", {int(partitions)}" if partitions is not None else ""
41-
sql = f"SELECT * FROM range({int(start)}, {int(stop)}, {int(step)}{parts})"
45+
sql = f"SELECT * FROM range({int(start)}, {int(stop)}, {int(step)}{parts})" # noqa: S608
4246
return ctx.sql(sql)

0 commit comments

Comments
 (0)