Skip to content

Commit

Permalink
Fix major bug where dense array was actually opening as sparse array
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Oct 31, 2023
1 parent 59956c7 commit a6dc282
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apis/python/src/tiledbsoma/_tdb_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def open(
return DataFrameWrapper.open(uri, mode, context, timestamp)
elif mode == "r" and clib.SOMASparseNDArray.exists(uri):
return SparseNDArrayWrapper.open(uri, mode, context, timestamp)
elif mode == "r" and clib.SOMADenseNDArray.exists(uri):
return DenseNDArrayWrapper.open(uri, mode, context, timestamp)
else:
return ArrayWrapper.open(uri, mode, context, timestamp)
if obj_type == "group":
Expand Down Expand Up @@ -434,7 +436,7 @@ def _opener(
timestamp: int,
) -> clib.SOMADenseNDArray:
open_mode = clib.OpenMode.read if mode == "r" else clib.OpenMode.write
return clib.SOMASparseNDArray.open(
return clib.SOMADenseNDArray.open(
uri,
open_mode,
{k: str(v) for k, v in context.tiledb_config.items()},
Expand Down
4 changes: 2 additions & 2 deletions apis/python/src/tiledbsoma/soma_dense_ndarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ void load_soma_dense_ndarray(py::module &m) {
})
.def_property_readonly("shape", &SOMADenseNDArray::shape)
.def_property_readonly("ndim", &SOMADenseNDArray::ndim)
.def("read_next", [](SOMASparseNDArray& dataframe){
.def("read_next", [](SOMADenseNDArray& soma_dense_ndarr){
// Release GIL when reading data
py::gil_scoped_release release;
auto buffers = dataframe.read_next();
auto buffers = soma_dense_ndarr.read_next();
py::gil_scoped_acquire acquire;

return to_table(buffers);
Expand Down

0 comments on commit a6dc282

Please sign in to comment.