Skip to content

Commit

Permalink
Merge pull request #2199 from mabel-dev/#1954-2
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer authored Jan 4, 2025
2 parents 936d451 + e48ca76 commit c7f4e23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion opteryx/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__build__ = 949
__build__ = 951

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
51 changes: 25 additions & 26 deletions opteryx/planner/ast_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,36 +264,35 @@ def rewrite_json_accessors(node: Dict[str, Any]) -> Dict[str, Any]:
}
}

if "BinaryOp" in right_node:
operator = next(iter(right_node))
if operator in (
"Like",
"ILike",
"NotLike",
"NotILike",
"RLike",
"NotRLike",
):
element = right_node[operator]["expr"]
comparitor = right_node[operator]["pattern"]
operator = next(iter(right_node))
if operator in (
"Like",
"ILike",
"NotLike",
"NotILike",
"RLike",
"NotRLike",
):
element = right_node[operator]["expr"]
comparitor = right_node[operator]["pattern"]

return {
"BinaryOp": {
"left": {
"BinaryOp": {"left": document, "op": accessor, "right": element},
},
"op": operator,
"right": comparitor,
}
return {
"BinaryOp": {
"left": {
"BinaryOp": {"left": document, "op": accessor, "right": element},
},
"op": operator,
"right": comparitor,
}
if operator in ("IsNull", "IsNotFalse", "IsNotNull", "IsNotTrue", "IsTrue", "IsFalse"):
element = right_node[operator]["Value"]
}
elif operator in ("IsNull", "IsNotFalse", "IsNotNull", "IsNotTrue", "IsTrue", "IsFalse"):
element = right_node[operator]["Value"]

return {
operator: {
"Nested": {"BinaryOp": {"left": document, "op": accessor, "right": element}}
}
return {
operator: {
"Nested": {"BinaryOp": {"left": document, "op": accessor, "right": element}}
}
}
else:
operator = next(iter(document))
if operator in (
Expand Down
2 changes: 2 additions & 0 deletions tests/sql_battery/test_run_only_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def test_run_only_tests(statement):

nl = "\n"

batch_start = time.monotonic_ns()
print(f"RUNNING BATTERY OF {len(RUN_ONLY_TESTS)} RUN_ONLY TESTS")
for index, statement in enumerate(RUN_ONLY_TESTS):
start = time.monotonic_ns()
Expand All @@ -80,3 +81,4 @@ def test_run_only_tests(statement):
print(f"\033[0;32m{str(int((time.monotonic_ns() - start)/1000000)).rjust(4)}ms\033[0m ✅")

print("--- ✅ \033[0;32mdone\033[0m")
print(f"Total time: {str(int((time.monotonic_ns() - batch_start)/1000000)).rjust(4)}ms")

0 comments on commit c7f4e23

Please sign in to comment.