Skip to content

Conversation

@hyanwong
Copy link
Member

@hyanwong hyanwong commented Nov 28, 2025

Fixes #2637 - I remembered this issue when writing some recent tutorial material.

I went for the absolute size rather than percentage, and simply appended the codec type, rather than having a separate column, as it seems simpler:

I will add tests if this seems like the right format:

Screenshot 2025-11-28 at 21 06 21

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.76%. Comparing base (f1b139e) to head (056973f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3343   +/-   ##
=======================================
  Coverage   89.76%   89.76%           
=======================================
  Files          29       29           
  Lines       31289    31295    +6     
  Branches     5737     5738    +1     
=======================================
+ Hits        28086    28092    +6     
  Misses       1794     1794           
  Partials     1409     1409           
Flag Coverage Δ
c-tests 86.77% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 87.12% <ø> (ø)
python-tests 98.85% <100.00%> (+<0.01%) ⬆️
python-tests-no-jit 33.51% <14.28%> (-0.02%) ⬇️
python-tests-numpy1 50.31% <100.00%> (+0.04%) ⬆️

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

Files with missing lines Coverage Δ
python/tskit/trees.py 98.89% <100.00%> (ø)
python/tskit/util.py 99.29% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hyanwong
Copy link
Member Author

hyanwong commented Nov 28, 2025

I just updated to a different style, with percentages. I thought it best not to show anything if the metadata and schema are both empty. Dunno if I prefer percentages or bytes? If percentages, perhaps the title should be e.g. "Metadata (%)"?

Screenshot 2025-11-28 at 21 48 53

@jeromekelleher
Copy link
Member

Bytes are better. How does this interact with the old "has metadata" flag? What happens when there is metadata but there's no schema (I think I see what it is not from rereading the code, but it would really help to use some variables and not try to make everything maximally cryptic).

Some simple unit tests here based on the output of metadata_details covering the various possibilities would be sufficient.

@hyanwong
Copy link
Member Author

hyanwong commented Dec 2, 2025

I'll go with bytes then. This replaces the "has_metadata" column (which I think is the right way to go: if there is text in there, it means either a schema is set or there is metadata). I'm trying not to bloat the tables with lots of extra text / columns, so if we are going with bytes, how about

No metadata, no schema =
Some metadata, no schema = (XXX bytes)
No metadata, schema set = schema_codec
Some metadata, schema set = schema_codec (XXX bytes)

So e.g.

╔═══════════╤════╤═════════╤═════════════════╗
║Table      │Rows│Size     │ Metadata (size) ║
╠═══════════╪════╪═════════╪═════════════════╣
║Edges      │   6│200 Bytes│                 ║
╟───────────┼────┼─────────┼─────────────────╢
║Individuals│   2│ 80 Bytes│  json (90 Bytes)║
╟───────────┼────┼─────────┼─────────────────╢
║Migrations │   0│  8 Bytes│                 ║
╟───────────┼────┼─────────┼─────────────────╢
║Mutations  │   0│ 16 Bytes│          struct ║
╟───────────┼────┼─────────┼─────────────────╢
║Nodes      │   7│204 Bytes│       (50 Bytes)║
╟───────────┼────┼─────────┼─────────────────╢
║Populations│   1│224 Bytes│struct (50 Bytes)║
╟───────────┼────┼─────────┼─────────────────╢
║Provenances│   1│  1.1 KiB│                 ║
╟───────────┼────┼─────────┼─────────────────╢
║Sites      │   0│ 16 Bytes│                 ║
╚═══════════╧════╧═════════╧═════════════════╝

? Other suggestions welcome, obviously. I could put e.g. an empty marker (e.g. -) in the blank columns, but I think that's just more confusing than leaving it blank?

The alternative is to have 2 columns, labelled e.g. Metadata schema and Metadata size? In this case would we put "" in the first column for the empty schema, and e.g. "0" in the second for no metadata?

@jeromekelleher
Copy link
Member

I think it's confusing to omit the bytes value when it's empty, just say "0 Bytes". I think it's probably easier to understand if we have two columns all right.

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.

Metadata size in tables

2 participants