Skip to content

Commit 5c2d931

Browse files
committed
Fix UDfs with no parameters; fix union check
1 parent 8f66d13 commit 5c2d931

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

accel.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,9 +2179,6 @@ static PyObject *load_rowdat_1_numpy(PyObject *self, PyObject *args, PyObject *k
21792179

21802180
// Get number of columns
21812181
n_cols = PyObject_Length(py_colspec);
2182-
if (n_cols == 0) {
2183-
goto error;
2184-
}
21852182

21862183
// Determine column types
21872184
ctypes = calloc(sizeof(int), n_cols);
@@ -3979,10 +3976,6 @@ static PyObject *load_rowdat_1(PyObject *self, PyObject *args, PyObject *kwargs)
39793976
end = data + (unsigned long long)length;
39803977

39813978
colspec_l = PyObject_Length(py_colspec);
3982-
if (colspec_l == 0) {
3983-
goto error;
3984-
}
3985-
39863979
ctypes = malloc(sizeof(int) * colspec_l);
39873980

39883981
for (i = 0; i < colspec_l; i++) {

singlestoredb/functions/signature.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import os
77
import re
88
import string
9+
import sys
10+
import types
911
import typing
1012
from typing import Any
1113
from typing import Callable
@@ -32,6 +34,11 @@
3234
from . import dtypes as dt
3335
from ..mysql.converters import escape_item # type: ignore
3436

37+
if sys.version_info >= (3, 10):
38+
_UNION_TYPES = {typing.Union, types.UnionType}
39+
else:
40+
_UNION_TYPES = {typing.Union}
41+
3542

3643
array_types: Tuple[Any, ...]
3744

@@ -211,7 +218,7 @@ def simplify_dtype(dtype: Any) -> List[Any]:
211218
args = []
212219

213220
# Flatten Unions
214-
if origin is Union:
221+
if origin in _UNION_TYPES:
215222
for x in typing.get_args(dtype):
216223
args.extend(simplify_dtype(x))
217224

0 commit comments

Comments
 (0)