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

added MatrixUnionCols IR #5037

Merged
merged 4 commits into from
Dec 24, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixed bug
  • Loading branch information
cseed committed Dec 22, 2018
commit d4277d0a5ba7d8ad767a9ee645b2177206be48f1
20 changes: 14 additions & 6 deletions hail/python/hail/matrixtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@ def __getitem__(self, item):
else:
raise invalid_usage

@property
def _col_key_types(self):
return [v.dtype for _, v in self.col_key.items()]

@property
def _row_key_types(self):
return [v.dtype for _, v in self.row_key.items()]

@property
def col_key(self):
"""Column key struct.
Expand Down Expand Up @@ -3114,16 +3122,16 @@ def union_cols(self, other: 'MatrixTable') -> 'MatrixTable':
"column types differ",
f" left: {self._col_type}",
f" right: {other.col_type}"))
if list(self.col_key.values()) != list(other.col_key.values()):
if list(self._col_key_types) != list(other._col_key_types):
raise ValueError("\n".join(
"column key types differ",
f" left: {', '.join(self.col_key.values())}",
f" right: {', '.join(other.col_key.values())}"))
if list(self.row_key.values()) != list(other.row_key.values()):
f" left: {', '.join(self._col_key_types)}",
f" right: {', '.join(other._col_key_types)}"))
if list(self._row_key_types) != list(other._row_key_types):
raise ValueError("\n".join(
"row key types differ",
f" left: {', '.join(self.row_key.values())}",
f" right: {', '.join(other.row_key.values())}"))
f" left: {', '.join(self._row_key_types)}",
f" right: {', '.join(other._row_key_types)}"))

return MatrixTable(MatrixUnionCols(self._mir, other._mir))

Expand Down