Skip to content

Commit

Permalink
FEAT-#6382: Execute bitwise NOT (~) operations on HDK
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com>
  • Loading branch information
AndreyPavlenko committed Oct 27, 2023
1 parent e12b217 commit aeedbf0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def invert(self) -> "OpExpr":
OpExpr
The resulting bitwise inverse expression.
"""
return OpExpr("~", [self], self._dtype)
return OpExpr("BIT_NOT", [self], self._dtype)

def _cmp_op(self, other, op_name):
"""
Expand Down Expand Up @@ -983,7 +983,7 @@ class OpExpr(BaseExpr):
"POWER": lambda self: self._fold_arithm("__pow__"),
"/": lambda self: self._fold_arithm("__truediv__"),
"//": lambda self: self._fold_arithm("__floordiv__"),
"~": lambda self: self._fold_invert(),
"BIT_NOT": lambda self: self._fold_invert(),
"CAST": lambda self: self._fold_literal("cast", self._dtype),
"IS NULL": lambda self: self._fold_literal("is_null"),
"IS NOT NULL": lambda self: self._fold_literal("is_not_null"),
Expand All @@ -996,15 +996,15 @@ class OpExpr(BaseExpr):
"POWER": lambda self, table: self._pc("power", table),
"/": lambda self, table: self._pc("divide", table),
"//": lambda self, table: self._pc("divide", table),
"~": lambda self, table: self._invert(table),
"BIT_NOT": lambda self, table: self._invert(table),
"CAST": lambda self, table: self._col(table).cast(to_arrow_type(self._dtype)),
"IS NULL": lambda self, table: self._col(table).is_null(nan_is_null=True),
"IS NOT NULL": lambda self, table: pc.invert(
self._col(table).is_null(nan_is_null=True)
),
}

_UNSUPPORTED_HDK_OPS = {"~"}
_UNSUPPORTED_HDK_OPS = {}

def __init__(self, op, operands, dtype):
self.op = op
Expand Down

0 comments on commit aeedbf0

Please sign in to comment.