Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1935 #1936

Merged
merged 2 commits into from
Aug 25, 2024
Merged

#1935 #1936

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opteryx/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__build__ = 741
__build__ = 742

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
8 changes: 7 additions & 1 deletion opteryx/functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def cast_varchar(arr):
return compute.cast(arr, "string")


def cast_blob(arr):
if len(arr) > 0 and all(i is None or type(i) == bytes for i in arr):
return arr
return compute.cast(arr, "binary")


def fixed_value_function(function, context):
from orso.types import OrsoTypes

Expand Down Expand Up @@ -321,7 +327,7 @@ def select_values(boolean_arrays, value_arrays):
"STR": cast_varchar,
"STRUCT": _iterate_single_parameter(lambda x: orjson.loads(str(x)) if x is not None else None),
"DATE": lambda x: compute.cast(x, pyarrow.date32()),
"BLOB": array_encode_utf8,
"BLOB": cast_blob,
"TRY_TIMESTAMP": try_cast("TIMESTAMP"),
"TRY_BOOLEAN": try_cast("BOOLEAN"),
"TRY_NUMERIC": try_cast("DOUBLE"),
Expand Down