Skip to content

Commit

Permalink
[Backport release-1.15] [python] Resolve issue with #3611 and `pyarro…
Browse files Browse the repository at this point in the history
…w<17` (#3671)

* [Backport release-1.15] [python] Resolve issue with #3611 and `pyarrow<17`

* Fix issue with pyarrow<17
  • Loading branch information
johnkerl authored Feb 4, 2025
1 parent fcde7ef commit a1ba80e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
11 changes: 7 additions & 4 deletions apis/python/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,10 +2092,13 @@ def test_arrow_table_validity_with_slicing(tmp_path):
)
table = pa.Table.from_pydict(pydict)

with soma.DataFrame.open(uri, "w") as A:
with raises_no_typeguard(soma.SOMAError):
# soma_joinid cannot be nullable
A.write(table)
# As of version 1.15.6 we were throwing in this case. However, we found
# a compatibility issue with pyarrow versions below 17. Thus this is
# now non-fatal.
# with soma.DataFrame.open(uri, "w") as A:
# with raises_no_typeguard(soma.SOMAError):
# # soma_joinid cannot be nullable
# A.write(table)

pydict["soma_joinid"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
table = pa.Table.from_pydict(pydict)
Expand Down
13 changes: 8 additions & 5 deletions apis/python/tests/test_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2022,11 +2022,14 @@ def test_sparse_nd_array_null(tmp_path):

soma.SparseNDArray.create(uri, type=pa.int64(), shape=(10,))

with soma.SparseNDArray.open(uri, "w") as A:
with raises_no_typeguard(soma.SOMAError):
# soma_joinid cannot be nullable
A.write(table[:5])
A.write(table[5:])
# As of version 1.15.6 we were throwing in this case. However, we found
# a compatibility issue with pyarrow versions below 17. Thus this is
# now non-fatal.
# with soma.SparseNDArray.open(uri, "w") as A:
# with raises_no_typeguard(soma.SOMAError):
# # soma_joinid cannot be nullable
# A.write(table[:5])
# A.write(table[5:])

pydict["soma_dim_0"] = pa.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
table = pa.Table.from_pydict(pydict)
Expand Down
8 changes: 6 additions & 2 deletions libtiledbsoma/src/soma/column_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ void ColumnBuffer::attach(Query& query, std::optional<Subarray> subarray) {
"to attach to Query");
}

// As of version 1.15.6 we were throwing here. However, we found a
// compatibility issue with pyarrow versions below 17. Thus we log and
// continue.
if (!validity_.empty() && is_dim) {
throw TileDBSOMAError(fmt::format(
"[ColumnBuffer::attach] Validity buffer passed for dimension '{}'",
LOG_DEBUG(fmt::format(
"[ColumnBuffer::attach] Validity buffer passed for dimension '{}' "
"is being ignored",
name_));
}

Expand Down

0 comments on commit a1ba80e

Please sign in to comment.