Skip to content

Commit 31c9131

Browse files
committed
fix: cast to StringArray, so it is clear the type expected
1 parent 1334dd5 commit 31c9131

File tree

1 file changed

+3
-3
lines changed
  • python/xorq/backends/let/datafusion

1 file changed

+3
-3
lines changed

python/xorq/backends/let/datafusion/udfs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import itertools
4+
import typing
45
from urllib.parse import parse_qs, urlsplit
56

67
import pyarrow as pa
@@ -132,12 +133,11 @@ def regex_split(s: str, pattern: str) -> list[str]:
132133

133134

134135
def temporal_strftime(array: dt.Timestamp(scale=9), pattern: dt.string) -> dt.string:
135-
patterns = pattern.unique()
136+
pattern, *_rest = typing.cast(pa.StringArray, pattern).unique().to_pylist()
136137

137-
if len(patterns) != 1:
138+
if len(_rest) > 0:
138139
raise com.XorqError(
139140
"Only a single scalar pattern is supported for DataFusion strftime"
140141
)
141142

142-
pattern = patterns[0].as_py()
143143
return pc.strftime(array, pattern)

0 commit comments

Comments
 (0)