Closed jairideout closed 6 years ago
Ping on this. We're doing a release for #599 relatively soon, so it would be good to lump in other bug fixes if they're attainable on short order
I'm really not sure what the best solution is here. I think the JSON formatter is actually incorrect as there isn't metadata to store since the dicts are empty. We don't have a way to represent this in HDF5 as the metadata are datasets named by their key, which doesn't exist.
I see two options here, either add a check into the JSON formatter for this edge case, or add a check into the constraints on table metadata such that, if all data are empty, that we set the metadata on an axis to be None
. The latter is kind of nice but without immutability, I don't know if we can actually enforce it.
Metadata is handled differently depending on underlying file format (JSON or HDF5).
This is related to a previous issue (#585) and fix (#589). The original issue occurred in QIIME's rarefaction unit tests (https://github.com/biocore/qiime/issues/1918).
Example:
Create an in-memory table with metadata as a list of empty dictionaries. Write this table as JSON and HDF5. Read the two tables back into memory and compare to the original table. The JSON table is equal to the in-memory table, but the HDF5 table is not because the metadata differ (
None
vs. a list ofdefaultdicts
):cc @josenavas @gregcaporaso @Jorge-C