-
Notifications
You must be signed in to change notification settings - Fork 79
Add options to table collection clear #1001
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
Conversation
4aa6642 to
49a5ac5
Compare
|
📖 Docs for this PR can be previewed here |
Codecov Report
@@ Coverage Diff @@
## main #1001 +/- ##
==========================================
+ Coverage 93.65% 93.66% +0.01%
==========================================
Files 26 26
Lines 20699 20758 +59
Branches 838 838
==========================================
+ Hits 19385 19444 +59
Misses 1277 1277
Partials 37 37
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
LGTM! Although - we don't seem to have discussed this in #929 - I would have thought the default would be to clear provenance, since what's the point of keeping provenance in an empty table? Provenance says where the information came from, but if there's no information... |
|
My thinking here was based on the existing usages of Basically you usually clear when you're modifying an existing table, which should retain provenance and metadata. |
This was my initial thought also. |
I see, that's a good point. What if we changed the flags to KEEP_PROVENANCE and KEEP_METADATA? It seems reasonable to me that the default behaviour would be to nuke everything, and then you can optionally keep some stuff in special cases where you want them? |
|
Ok, that's a good point. I guess in practice if we want a totally brand-new table collection then we tend to just re-allocate a new one. So, I agree, what you've done here actually makes more sense. OK, never mind - I vote to keep it the way you've got it! |
|
How does this look at the Python level @benjeffery - did we not provide a TableCollection.clear() method? It might be worth doing this now, as the "direction" the flags need to be in usually becomes clearer after we think through the semantics in Python. Peter makes a good point too - if we want to totally crispy clean table collection, we can just make a new one, so I'm leaning towards agreeing with what you have. |
There is no such method in the Python API - I assume the test suite would benefit from it. I'll have a look for potential usage and add it to this PR - setting back to draft till that is in.
I also agree with this - what's the point (especially in Python) of a complete clear? |
60e42a1 to
d7e293f
Compare
|
Only found one spot in the Python tests to use this - but I still think it is worth having. @jeromekelleher I think this is merge-ready. |
jeromekelleher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
d7e293f to
84b478e
Compare
Description
Adds options to
tsk_table_collection_clear. Also changes the default behaviour by not clearing the provenance table. In the original issue I thought clear should wipe everything - but I've come round to the idea that the most common clearing operation is where you want to retain the provenance and metadata schemas. We should encourage retaining these by default in a table-modifying operation.Fixes #929
PR Checklist: