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

Refactor OperatorMsg #3773

Merged
merged 14 commits into from
Sep 27, 2024
Merged
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
9 changes: 9 additions & 0 deletions .configs/registration-config-multi-dim.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"bigint"
]
},
"binop": {
"dtype": [
"int",
"uint",
"real",
"bool",
"bigint"
]
},
"scalar": {
"dtype": [
"int",
Expand Down
9 changes: 9 additions & 0 deletions .configs/registration-config-single-dim.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"bigint"
]
},
"binop": {
"dtype": [
"int",
"uint",
"real",
"bool",
"bigint"
]
},
"scalar": {
"dtype": [
"int",
Expand Down
23 changes: 15 additions & 8 deletions arkouda/pdarrayclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,10 @@ def _binop(self, other: pdarray, op: str) -> pdarray:
x1, x2, tmp_x1, tmp_x2 = broadcast_if_needed(self, other)
except ValueError:
raise ValueError(f"shape mismatch {self.shape} {other.shape}")
repMsg = generic_msg(cmd=f"binopvv{x1.ndim}D", args={"op": op, "a": x1, "b": x2})
repMsg = generic_msg(
cmd=f"binopvv<{self.dtype},{other.dtype},{x1.ndim}>",
args={"op": op, "a": x1, "b": x2}
)
if tmp_x1:
del x1
if tmp_x2:
Expand All @@ -537,8 +540,8 @@ def _binop(self, other: pdarray, op: str) -> pdarray:
if dt not in DTypes:
raise TypeError(f"Unhandled scalar type: {other} ({type(other)})")
repMsg = generic_msg(
cmd=f"binopvs{self.ndim}D",
args={"op": op, "a": self, "dtype": dt, "value": other},
cmd=f"binopvs<{self.dtype},{dt},{self.ndim}>",
args={"op": op, "a": self, "value": other},
)
return create_pdarray(repMsg)

Expand Down Expand Up @@ -582,8 +585,8 @@ def _r_binop(self, other: pdarray, op: str) -> pdarray:
if dt not in DTypes:
raise TypeError(f"Unhandled scalar type: {other} ({type(other)})")
repMsg = generic_msg(
cmd=f"binopsv{self.ndim}D",
args={"op": op, "dtype": dt, "value": other, "a": self},
cmd=f"binopsv<{self.dtype},{dt},{self.ndim}>",
args={"op": op, "dtype": dt, "a": self, "value": other},
)
return create_pdarray(repMsg)

Expand Down Expand Up @@ -774,7 +777,10 @@ def opeq(self, other, op):
if isinstance(other, pdarray):
if self.shape != other.shape:
raise ValueError(f"shape mismatch {self.shape} {other.shape}")
generic_msg(cmd=f"opeqvv{self.ndim}D", args={"op": op, "a": self, "b": other})
generic_msg(
cmd=f"opeqvv<{self.dtype},{other.dtype},{self.ndim}>",
args={"op": op, "a": self, "b": other}
)
return self
# pdarray binop scalar
# opeq requires scalar to be cast as pdarray dtype
Expand All @@ -788,8 +794,9 @@ def opeq(self, other, op):
raise TypeError(f"Unhandled scalar type: {other} ({type(other)})")

generic_msg(
cmd=f"opeqvs{self.ndim}D",
args={"op": op, "a": self, "dtype": self.dtype.name, "value": self.format_other(other)},
# TODO: does opeqvs really need to select over pairs of dtypes?
cmd=f"opeqvs<{self.dtype},{self.dtype},{self.ndim}>",
args={"op": op, "a": self, "value": self.format_other(other)},
)
return self

Expand Down
9 changes: 9 additions & 0 deletions registration-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
"bigint"
]
},
"binop": {
"dtype": [
"int",
"uint",
"real",
"bool",
"bigint"
]
},
"scalar": {
"dtype": [
"int",
Expand Down
Loading
Loading