-
Notifications
You must be signed in to change notification settings - Fork 74
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
Method to in-place subset a table #2666
Comments
Sounds like a good addition to the API - a boolean mask seems to best way to me. I assume that we're not too concerned with perf here? If we are an easy win would be to expand the table once (as the number of rows needed is known) and call As for naming, |
One more thought, just realised - the code above is almost equal to:
So maybe an alternative is adding |
Aha - so it is! x_table_extend is documented though, so changes break the 1.0 API contracts. Also we don't think about ID remapping at all in extend, which is a key part of the operation here (updating the mutation/individual table is sooooo tedious!). I think |
In #2665 I added a draft function that looked like this:
The idea is that we can keep/delete a subset of the rows in a table, in place, and optionally return the mapping of new-to-old IDs. I implemented this as
delete_rows
here, but it felt a bit unnatural and maybe it would be better to do it askeep_rows
instead? Maybesubset(bool *keep_rows)
? Any better ideas?I juggled with the idea of providing a list of row indexes instead, but I think the boolean mask is more generally useful, and is easy to set up if you do have a list of rows you want to get rid of/keep.
The idea is to do this for all tables, and for tables that self-reference (e.g. mutation table) to automatically remap those references and to (by default) return an error if you try to delete a row that has references to it.
See also #1034
The text was updated successfully, but these errors were encountered: