Skip to content

Commit

Permalink
remove warning; better testing
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Jun 29, 2023
1 parent 425f04a commit 99f3dd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 3 additions & 7 deletions src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,13 +2162,9 @@ def compatible_partitions(*args: Array) -> bool:
if arg.known_divisions:
if arg.divisions != refarr.divisions:
return False
else:
warnings.warn(
f"Collection {arg.name} has unknown divisions (but has the "
f"same number of partitions as {refarr.name}; it's possible "
"that your task graph may fail at compute time if the "
"divisions are actually incompatible."
)

# if we reach this point we consider the partitions compatible.

return True


Expand Down
9 changes: 6 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
typetracer_array,
)
from dask_awkward.lib.testutils import assert_eq
from dask_awkward.utils import IncompatiblePartitions

if TYPE_CHECKING:
from dask_awkward.lib.core import Array
Expand Down Expand Up @@ -479,6 +480,9 @@ def test_compatible_partitions_after_slice() -> None:
assert not compatible_partitions(lazy[:-2], lazy)
assert not compatible_partitions(lazy[:-2], dak.num(lazy, axis=1) != 3)

with pytest.raises(IncompatiblePartitions, match="incompatibly partitioned"):
(lazy[:-2] + lazy).compute()


def test_compatible_partitions_mixed() -> None:
a = ak.Array([[1, 2, 3], [0, 0, 0, 0], [5, 6, 7, 8, 9], [0, 0, 0, 0]])
Expand All @@ -488,9 +492,8 @@ def test_compatible_partitions_mixed() -> None:
d = b[dak.num(b, axis=1) >= 3]
assert not c.known_divisions
# compatible partitions is going to get called in the __add__ ufunc
with pytest.warns(UserWarning, match="unknown divisions"):
e = b + c
f = b + d
e = b + c
f = b + d
with pytest.raises(ValueError):
e.compute()
assert_eq(f, a + a)
Expand Down

0 comments on commit 99f3dd9

Please sign in to comment.