Skip to content

Commit

Permalink
[python] Use same default maxdomain between Python and R
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Sep 28, 2024
1 parent e1215c6 commit 413e34d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
5 changes: 2 additions & 3 deletions apis/python/src/tiledbsoma/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,8 @@ def _fill_out_slot_soma_domain(
# Here the slot_domain isn't specified by the user; we're setting it.
# The SOMA spec disallows negative soma_joinid.
if index_column_name == SOMA_JOINID:
slot_domain = 2**63-1
else:
saturated_range = True
slot_domain = (0, 2**63 - 2)
saturated_range = True
elif np.issubdtype(dtype, NPFloating):
finfo = np.finfo(cast(NPFloating, dtype))
slot_domain = finfo.min, finfo.max
Expand Down
2 changes: 1 addition & 1 deletion apis/python/src/tiledbsoma/_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def _dim_capacity_and_extent(
int64 is returned for the capacity.
"""
if dim_shape is None:
dim_capacity = 2**63-1
dim_capacity = 2**63 - 1
dim_extent = min(dim_capacity, create_options.dim_tile(dim_name, 2048))
# Avoid core array-creation error since max must have room for one tile extent
dim_capacity -= dim_extent
Expand Down
10 changes: 0 additions & 10 deletions apis/python/tests/test_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,6 @@ def test_sparse_nd_array_basics(
with tiledbsoma.SparseNDArray.open(uri) as snda:
assert snda.shape == arg_shape

# Test resize too big
new_shape = tuple([4_000_000_000 for i in range(ndim)])
# TODO: check draft spec
# with pytest.raises(ValueError):
with pytest.raises(tiledbsoma.SOMAError):
with tiledbsoma.SparseNDArray.open(uri, "w") as snda:
snda.resize(new_shape)
with tiledbsoma.SparseNDArray.open(uri) as snda:
assert snda.shape == arg_shape

# Test writes out of bounds
with tiledbsoma.SparseNDArray.open(uri, "w") as snda:
with pytest.raises(tiledbsoma.SOMAError):
Expand Down

0 comments on commit 413e34d

Please sign in to comment.