Skip to content

Commit

Permalink
Merge pull request #1712 from mabel-dev/0.15.1
Browse files Browse the repository at this point in the history
0.15.1
  • Loading branch information
joocer authored May 31, 2024
2 parents 4330387 + 7056a3a commit 75698c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
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

0 comments on commit 75698c3

Please sign in to comment.