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

FEAT-#6382: Execute bitwise NOT (~) operations on HDK #6383

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we test this operation on HDK?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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