Skip to content

Commit

Permalink
Revert #439 (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl authored Oct 20, 2022
1 parent 1626db8 commit cc52607
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 28 deletions.
6 changes: 4 additions & 2 deletions apis/python/src/tiledbsoma/query_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class QueryCondition:
"""

expression: str
ctx: tiledb.Ctx = field(default_factory=tiledb.default_ctx, repr=False)
tree: ast.Expression = field(init=False, repr=False)
c_obj: PyQueryCondition = field(init=False, repr=False)

Expand All @@ -130,7 +131,7 @@ def __post_init__(self):
)

def init_query_condition(self, schema: tiledb.ArraySchema, query_attrs: List[str]):
qctree = QueryConditionTree(schema, query_attrs)
qctree = QueryConditionTree(self.ctx, schema, query_attrs)
self.c_obj = qctree.visit(self.tree.body)

if not isinstance(self.c_obj, PyQueryCondition):
Expand All @@ -142,6 +143,7 @@ def init_query_condition(self, schema: tiledb.ArraySchema, query_attrs: List[str

@dataclass
class QueryConditionTree(ast.NodeVisitor):
ctx: tiledb.Ctx
schema: tiledb.ArraySchema
query_attrs: List[str]

Expand Down Expand Up @@ -239,7 +241,7 @@ def aux_visit_Compare(
dtype = "string" if dt.kind in "SUa" else dt.name
val = self.cast_val_to_dtype(val, dtype)

pyqc = PyQueryCondition()
pyqc = PyQueryCondition(self.ctx)
self.init_pyqc(pyqc, dtype)(att, val, op)

return pyqc
Expand Down
4 changes: 1 addition & 3 deletions apis/python/src/tiledbsoma/soma_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import scipy.sparse as sp
import tiledb

import tiledbsoma.libtiledbsoma as clib

from . import util_arrow
from .soma_collection import SOMACollectionBase
from .tiledb_array import TileDBArray
Expand Down Expand Up @@ -144,7 +142,7 @@ def nnz(self) -> int:
"""
Return the number of stored values in the array, including explicitly stored zeros.
"""
return cast(int, clib.SOMAReader(self.uri).nnz())
raise NotImplementedError("SOMASparseNdArray.nnz is not implemented.")

def read_sparse_tensor(
self,
Expand Down
6 changes: 4 additions & 2 deletions apis/python/tests/test_soma_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,15 @@ def test_soma_sparse_nd_array_nnz(tmp_path):
"""
a = soma.SOMASparseNdArray(tmp_path.as_posix())
a.create(type=pa.int32(), shape=(10, 10, 10))
assert a.nnz == 0
with pytest.raises(NotImplementedError):
assert a.nnz == 0

t: pa.SparseCOOTensor = create_random_tensor(
"coo", a.shape, pa.int32().to_pandas_dtype(), 0.1
)
a.write_sparse_tensor(t)
assert t.non_zero_length == a.nnz
with pytest.raises(NotImplementedError):
assert t.non_zero_length == a.nnz


def test_soma_sparse_nd_array_reshape(tmp_path):
Expand Down
6 changes: 2 additions & 4 deletions libtiledbsoma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ option(SUPERBUILD "If true, perform a superbuild (builds all missing dependencie
option(CMAKE_IDE "(Used for CLion builds). Disables superbuild and sets the EP install dir." OFF)
option(FORCE_BUILD_TILEDB "Forces a local build of TileDB instead of searching system paths." ON)
option(TILEDB_FORCE_ALL_DEPS "Forces a local build of TileDB instead of searching system paths." OFF)
# TODO: keep this until the next TileDB core release
# option(DOWNLOAD_TILEDB_PREBUILT "If tiledb is being super built, this controls downloading prebuilt artifacts or building from source" ON)
option(DOWNLOAD_TILEDB_PREBUILT "If tiledb is being super built, this controls downloading prebuilt artifacts or building from source" OFF)
option(DOWNLOAD_TILEDB_PREBUILT "If tiledb is being super built, this controls downloading prebuilt artifacts or building from source" ON)

# TileDB BUILD Options
option(TILEDB_S3 "Enables S3/minio support using aws-cpp-sdk" ON)
Expand Down Expand Up @@ -154,7 +152,7 @@ if (MSVC)
# C4996: deprecation warning about e.g. sscanf.
add_compile_options(/W4 /wd4101 /wd4146 /wd4244 /wd4251 /wd4456 /wd4457 /wd4702 /wd4800 /wd4996)
# Warnings as errors:
if (TILEDBSOMA_ENABLE_WERROR)
if (ENABLE_TILEDBSOMA_WERROR)
add_compile_options(/WX)
endif()
# Disable GDI (which we don't need, and causes some macro
Expand Down
7 changes: 2 additions & 5 deletions libtiledbsoma/cmake/Modules/FindTileDB_EP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ else()
else() # Build from source
ExternalProject_Add(ep_tiledb
PREFIX "externals"
# TODO: keep this until the next TileDB core release
# URL "https://github.com/TileDB-Inc/TileDB/archive/2.11.1.zip"
# URL_HASH SHA1=98505ca9924b0fe703feb0da08c0918e675b2a8f
GIT_REPOSITORY "https://github.com/TileDB-Inc/TileDB/"
GIT_TAG "yt/ch22464/make_logger_prefix_unique-2.12"
URL "https://github.com/TileDB-Inc/TileDB/archive/2.11.1.zip"
URL_HASH SHA1=98505ca9924b0fe703feb0da08c0918e675b2a8f
DOWNLOAD_NAME "tiledb.zip"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
Expand Down
5 changes: 1 addition & 4 deletions libtiledbsoma/src/pyapi/query_condition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ class PyQueryCondition {
PyQueryCondition() = delete;

PyQueryCondition(py::object ctx) {
(void)ctx;
try {
// create one global context for all query conditions
static Context context = Context();
ctx_ = context;
set_ctx(ctx);
qc_ = shared_ptr<QueryCondition>(new QueryCondition(ctx_));
} catch (TileDBError &e) {
TPY_ERROR_LOC(e.what());
Expand Down
6 changes: 0 additions & 6 deletions libtiledbsoma/src/soma_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ uint64_t SOMAReader::nnz() {
//===============================================================
// If only one fragment, return total_cell_num
auto fragment_count = fragment_info.fragment_num();

if (fragment_count == 0) {
// Array schema has been created but no data have been written
return 0;
}

if (fragment_count == 1) {
return fragment_info.total_cell_num();
}
Expand Down
2 changes: 0 additions & 2 deletions scripts/bld
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ else
# non-trivial cmake debugging.
if [ ! -z "$LIBTILEDBSOMA_DEBUG_BUILD" ]; then
EXTRA_OPTS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
# TILEDB_WERROR=OFF is necessary to build core with XCode 14; doesn't hurt for XCode 13.
# EXTRA_OPTS="-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DTILEDB_WERROR=OFF _DENABLE_TILEDBSOMA_WERROR=OFF"
fi
# Also (pro-tip), set nproc=1 to get a more deterministic ordering of output lines.
if [ ! -z "$LIBTILEDBSOMA_NO_PARALLEL_BUILD" ]; then
Expand Down

0 comments on commit cc52607

Please sign in to comment.