Skip to content

Commit

Permalink
[python] Fix readback of some older-style metadata (#3653) (#3655)
Browse files Browse the repository at this point in the history
* [python] Fix readback of some older-style metadata

* other fix; why not both?

Co-authored-by: John Kerl <[email protected]>
  • Loading branch information
github-actions[bot] and johnkerl authored Jan 31, 2025
1 parent 356e4f5 commit 93a3bf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apis/python/src/tiledbsoma/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ py::dict meta(std::map<std::string, MetadataValue> metadata_mapping) {
for (auto [key, val] : metadata_mapping) {
auto [tdb_type, value_num, value] = val;

if (tdb_type == TILEDB_STRING_UTF8) {
if (tdb_type == TILEDB_STRING_UTF8 || tdb_type == TILEDB_STRING_ASCII) {
// Empty strings stored as nullptr have a value_num of 1 and a \x00
// value
if (value_num == 1 && value == nullptr) {
Expand All @@ -226,7 +226,7 @@ py::dict meta(std::map<std::string, MetadataValue> metadata_mapping) {
results[py::str(key)] = py::array(value_type, value_num, value)
.attr("item")(0);
} else {
py::dtype value_type = tdb_to_np_dtype(tdb_type, 1);
py::dtype value_type = tdb_to_np_dtype(tdb_type, value_num);
results[py::str(key)] = py::array(value_type, value_num, value)
.attr("item")(0);
}
Expand Down

0 comments on commit 93a3bf0

Please sign in to comment.