Skip to content

Abstract out offset column writing. - #1529

Merged
mergify[bot] merged 2 commits into
tskit-dev:mainfrom
jeromekelleher:factor-out-offset-cols
Jun 28, 2021
Merged

mergify[bot] merged 2 commits into
tskit-dev:mainfrom
jeromekelleher:factor-out-offset-cols

Conversation

@jeromekelleher

Copy link
Copy Markdown
Member

Some groundwork for making offset columns more flexible in the file format.

@codecov

codecov Bot commented Jun 25, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #1529 (7432f35) into main (9bb32d9) will decrease coverage by 0.27%.
The diff coverage is 84.34%.

❗ Current head 7432f35 differs from pull request most recent head bb09640. Consider uploading reports for the commit bb09640 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1529      +/-   ##
==========================================
- Coverage   93.77%   93.49%   -0.28%     
==========================================
  Files          27       27              
  Lines       22681    22832     +151     
  Branches     1076     1076              
==========================================
+ Hits        21268    21346      +78     
- Misses       1379     1452      +73     
  Partials       34       34              
Flag Coverage Δ
c-tests 91.61% <84.34%> (-0.55%) ⬇️
lwt-tests 92.97% <ø> (ø)
python-c-tests 95.28% <ø> (ø)
python-tests 98.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
c/tskit/tables.c 89.44% <84.34%> (-0.93%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bb32d9...bb09640. Read the comment docs.

@jeromekelleher
jeromekelleher force-pushed the factor-out-offset-cols branch from 9990334 to e23de92 Compare June 25, 2021 11:20
@jeromekelleher
jeromekelleher force-pushed the factor-out-offset-cols branch 2 times, most recently from bb09640 to c5c620a Compare June 26, 2021 09:52
@jeromekelleher
jeromekelleher marked this pull request as ready for review June 26, 2021 09:53
@jeromekelleher

jeromekelleher commented Jun 26, 2021 •

Copy link
Copy Markdown
Member Author

This is ready for review now @benjeffery. The idea here is to refactor the table reading/writing code to make it as declarative as possible at the table level. There is some repeated functionality in the three read_x functions, which we should try to factor out (i.e., detecting mismatching types, mandatory columns etc), but I think we should update the semantics first to account for the upcoming file format changes, and then look to refactor them.

FYI, the changes I have in mind are (a) make all ragged column pairs optional (the semantics are clear); (b) make the offset column either 32 or 64 bit in the file depending on the size of the largest offset value. This should allow us to make the 32 -> 64 bit offset transition pretty seamlessly from a file format perspective.

@benjeffery benjeffery left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good improvement - one tiny typo in a comment.

Comment thread c/tests/test_file_format.c Outdated
tsk_treeseq_t *ts = caterpillar_tree(5, 3, 3);
/* We exclude "provenances/timestamp_offset" here because there are no
* non-ragged columns in the provenances table, so this doesn't quite
* fit into the same patter as the other tables */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* fit into the same patter as the other tables */
* fit into the same pattern as the other tables */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

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