Skip to content

Commit c8250d9

Browse files
committed
feat: update lead and lag functions to handle default_value as an array
1 parent 5295260 commit c8250d9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

python/datafusion/functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,8 +2449,8 @@ def lead(
24492449
partition_by: Expressions to partition the window frame on.
24502450
order_by: Set ordering within the window frame.
24512451
"""
2452-
if not isinstance(default_value, pa.Scalar) and default_value is not None:
2453-
default_value = pa.scalar(default_value)
2452+
if default_value is not None and not hasattr(default_value, "__arrow_c_array__"):
2453+
default_value = pa.array([default_value])
24542454

24552455
partition_by_raw = expr_list_to_raw_expr_list(partition_by)
24562456
order_by_raw = sort_list_to_raw_sort_list(order_by)
@@ -2499,8 +2499,8 @@ def lag(
24992499
partition_by: Expressions to partition the window frame on.
25002500
order_by: Set ordering within the window frame.
25012501
"""
2502-
if not isinstance(default_value, pa.Scalar):
2503-
default_value = pa.scalar(default_value)
2502+
if default_value is not None and not hasattr(default_value, "__arrow_c_array__"):
2503+
default_value = pa.array([default_value])
25042504

25052505
partition_by_raw = expr_list_to_raw_expr_list(partition_by)
25062506
order_by_raw = sort_list_to_raw_sort_list(order_by)

0 commit comments

Comments
 (0)