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

0.15.1 #1712

Merged
merged 2 commits into from
May 31, 2024
Merged

0.15.1 #1712

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
8 changes: 4 additions & 4 deletions opteryx/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__build__ = 540
__build__ = 541

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,9 +27,9 @@ class VersionStatus(Enum):


_major = 0
_minor = 16
_revision = 0
_status = VersionStatus.ALPHA
_minor = 15
_revision = 1
_status = VersionStatus.RELEASE

__author__ = "@joocer"
__version__ = f"{_major}.{_minor}.{_revision}" + (
Expand Down
1 change: 1 addition & 0 deletions opteryx/functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def select_values(boolean_arrays, value_arrays):
"LEVENSHTEIN": string_functions.levenshtein,
"SPLIT": string_functions.split,
"MATCH_AGAINST": string_functions.match_against,
"REGEXP_REPLACE": string_functions.regex_replace,

# HASHING & ENCODING
"HASH": _iterate_single_parameter(lambda x: hex(CityHash64(str(x)))[2:]),
Expand Down
7 changes: 7 additions & 0 deletions opteryx/functions/string_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,10 @@ def match_against(arr, val):
and set(tokenized_literal).issubset(tok)
for tok in tokenized_strings
]

def regex_replace(array, _pattern, _replacement):

pattern = _pattern[0]
replacement = _replacement[0]

return compute.replace_substring_regex(array, pattern, replacement)
1 change: 1 addition & 0 deletions tests/sql_battery/test_shapes_and_errors_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@
("SELECT $missions.* FROM $missions INNER JOIN $user ON Mission = value WHERE attribute = 'membership'", 1, 8, None),
("SELECT * FROM $planets WHERE name = any(@@user_memberships)", 0, 20, None),
("SELECT name FROM sqlite.planets WHERE name = ANY(('Earth', 'Mars'))", 2, 1, None),
("SELECT name FROM $planets WHERE REGEXP_REPLACE(name, '^E', 'G') == 'Garth'", 1, 1, None),

# TEST FUNCTIONS
("EXECUTE PLANETS_BY_ID (id=1)", 1, 20, None), # simple case
Expand Down
Loading