Skip to content

Commit

Permalink
[c++] Migrate current domain resize to use SOMAColumn (#3643)
Browse files Browse the repository at this point in the history
* Migrate shape getter to SOMAColumn

* Migrate shape upgrade checker to SOMAColumn

* Migrate shape setter to SOMAColumn

* Fix ndrectangle initialization

* Update test assertions

* Update attribute and dimension name getters

* Migrate optional soma_joinid shape getters

* Migrate dataframe domain setters

* Fix the attribute column generation order whem metadata are missing

* Add missing return statement

* Replace const string with string_view

* Migrate joinid shape setters to SOMAColumn

* ArrowSchema generation improvement
  • Loading branch information
XanthosXanthopoulos authored Feb 4, 2025
1 parent fc536fa commit ce0dc82
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 544 deletions.
14 changes: 10 additions & 4 deletions apis/python/tests/test_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def test_sparse_nd_array_basics(
with tiledbsoma.SparseNDArray.open(uri, "w") as snda:
(ok, msg) = snda.resize(new_shape, check_only=True)
assert not ok
assert msg == "can_resize for soma_dim_0: new 50 < existing shape 100"
assert (
msg
== "[can_resize] index-column name 'soma_dim_0': new upper 49 < old upper 99 (downsize is unsupported)"
)
# TODO: check draft spec
# with pytest.raises(ValueError):
with pytest.raises(tiledbsoma.SOMAError):
Expand Down Expand Up @@ -175,7 +178,10 @@ def test_sparse_nd_array_basics(
too_small = tuple(e - 1 for e in new_shape)
(ok, msg) = snda.resize(too_small, check_only=True)
assert not ok
assert msg == "can_resize for soma_dim_0: new 149 < existing shape 150"
assert (
msg
== "[can_resize] index-column name 'soma_dim_0': new upper 148 < old upper 149 (downsize is unsupported)"
)

with tiledbsoma.SparseNDArray.open(uri, "w") as snda:
(ok, msg) = snda.resize(new_shape, check_only=True)
Expand Down Expand Up @@ -518,7 +524,7 @@ def _check_ndarray(ndarray, has_shapes, expected_shape):
assert "dataframe already has a domain" in msg
else:
assert not ok
assert "new lower > new upper" in msg
assert "new lower 10 > new upper 4" in msg

ok, msg = exp.obs.tiledbsoma_upgrade_domain([[0, 1]], check_only=True)
if has_shapes:
Expand Down Expand Up @@ -597,7 +603,7 @@ def _check_ndarray(ndarray, has_shapes, expected_shape):
)
else:
assert (
"Not OK: can_resize for soma_dim_1: new 13713 < existing shape 13714"
"Not OK: [can_resize] index-column name 'soma_dim_1': new upper 13712 < old upper 13713 (downsize is unsupported)"
in body
)

Expand Down
Loading

0 comments on commit ce0dc82

Please sign in to comment.