Skip to content

Commit a4606ab

Browse files
committed
casting to numpy arrays
1 parent 822477d commit a4606ab

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

opteryx/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__build__ = 1422
1+
__build__ = 1423
22

33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

opteryx/functions/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ def _inner(arr, *args):
237237

238238

239239
def cast_to_varchar(arr, *args):
240+
if hasattr(arr, "to_numpy"):
241+
arr = arr.to_numpy(False)
240242
if arr.dtype == numpy.float64:
241243
# If the array is a float64, we can use the fast format_double_array_strings
242244
return format_double_array_ascii(arr)
@@ -251,6 +253,8 @@ def cast_to_varchar(arr, *args):
251253

252254

253255
def cast_to_blob(arr, *args):
256+
if hasattr(arr, "to_numpy"):
257+
arr = arr.to_numpy(False)
254258
if arr.dtype == numpy.float64:
255259
# If the array is a float64, we can use the fast format_double_array_strings
256260
return format_double_array_bytes(arr)

0 commit comments

Comments
 (0)