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

[Hail][feature] add `outer` option to `union_cols` #7475

Merged
merged 6 commits into from Nov 11, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

better test

  • Loading branch information
patrick-schultz committed Nov 7, 2019
commit 9e2ade1424c6eacea4d6f7e289aac7eb17c27683
@@ -531,9 +531,20 @@ def test_union_cols_distinct(self):
assert mt.union_cols(mt).count_rows() == 5

def test_union_cols_outer(self):

This comment has been minimized.

Copy link
@tpoterba

tpoterba Nov 6, 2019

Collaborator

can you add a test for correct entry joining?

mt = hl.utils.range_matrix_table(10, 1)
mt2 = mt.key_rows_by(row_idx=mt.row_idx + 5)
assert mt.union_cols(mt2, _outer=True).count_rows() == 15
r, c = 10, 10
mt = hl.utils.range_matrix_table(2*r, c)
mt = mt.annotate_entries(entry=hl.tuple([mt.row_idx, mt.col_idx]))
mt2 = hl.utils.range_matrix_table(2*r, c)
mt2 = mt2.key_rows_by(row_idx=mt2.row_idx + r)
mt2 = mt2.key_cols_by(col_idx=mt2.col_idx + c)
mt2 = mt2.annotate_entries(entry=hl.tuple([mt2.row_idx, mt2.col_idx]))
expected = hl.utils.range_matrix_table(3*r, 2*c)
missing = hl.null(hl.ttuple(hl.tint, hl.tint))
expected = expected.annotate_entries(entry=hl.cond(
expected.col_idx < c,
hl.cond(expected.row_idx < 2*r, hl.tuple([expected.row_idx, expected.col_idx]), missing),
hl.cond(expected.row_idx >= r, hl.tuple([expected.row_idx, expected.col_idx]), missing)))
assert mt.union_cols(mt2, _outer=True)._same(expected)

def test_union_rows_different_col_schema(self):
mt = hl.utils.range_matrix_table(10, 10)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.