From a6dc282e95a93238190e3b1f4e45ad1095cfd5d6 Mon Sep 17 00:00:00 2001 From: Vivian Nguyen Date: Tue, 31 Oct 2023 11:12:08 -0500 Subject: [PATCH] Fix major bug where dense array was actually opening as sparse array --- apis/python/src/tiledbsoma/_tdb_handles.py | 4 +++- apis/python/src/tiledbsoma/soma_dense_ndarray.cc | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apis/python/src/tiledbsoma/_tdb_handles.py b/apis/python/src/tiledbsoma/_tdb_handles.py index 40a27f5ab8..1a2105c089 100644 --- a/apis/python/src/tiledbsoma/_tdb_handles.py +++ b/apis/python/src/tiledbsoma/_tdb_handles.py @@ -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": @@ -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()}, diff --git a/apis/python/src/tiledbsoma/soma_dense_ndarray.cc b/apis/python/src/tiledbsoma/soma_dense_ndarray.cc index 7788f38d7d..5c31c2c68c 100644 --- a/apis/python/src/tiledbsoma/soma_dense_ndarray.cc +++ b/apis/python/src/tiledbsoma/soma_dense_ndarray.cc @@ -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);