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

[query] Improve _same to make exactly one pass over the data #13151

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

danking
Copy link
Contributor

@danking danking commented Jun 7, 2023

This both avoids an extra pass to find the failing rows as well as avoiding a an extra pass if the globals depend on non-global data. In particular, this pipeline would run the column aggregations four times (IMO, at most twice is OK):

mt = hl.utils.range_matrix_table(2,2)
mt = mt.annotate_entries(x = mt.row_idx * mt.col_idx)
mt = mt.annotate_cols(mean_x = hl.agg.mean(mt.x))
mt = mt.annotate_entries(x = mt.x - mt.mean_x)
mt._same(mt)

This both avoids an extra pass to find the failing rows as well as avoiding a an extra pass if the
globals depend on non-global data. In particular, this pipeline would run the column aggregations
four times (IMO, at most twice is OK):

```
mt = hl.utils.range_matrix_table(2,2)
mt = mt.annotate_entries(x = mt.row_idx * mt.col_idx)
mt = mt.annotate_cols(mean_x = hl.agg.mean(mt.x))
mt = mt.annotate_entries(x = mt.x - mt.mean_x)
mt._same(mt)
```
@danking danking merged commit 62f606c into hail-is:main Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants