Skip to content

Commit bf85767

Browse files
authored
Merge pull request #156 from dask-contrib/fix-dh-factory
fix: dask_histogram.factory broken after dask 2024.12
2 parents 8920ec8 + d3cb1a1 commit bf85767

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/dask_histogram/core.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,15 +1027,8 @@ def _partitioned_histogram(
10271027
if len(data) == 1 and data_is_dak:
10281028
from dask_awkward.lib.core import partitionwise_layer as dak_pwl
10291029

1030-
x = data[0]
1031-
if weights is not None and sample is not None:
1032-
g = dak_pwl(_blocked_dak, name, x, weights, sample, histref=histref)
1033-
elif weights is not None and sample is None:
1034-
g = dak_pwl(_blocked_dak, name, x, weights, None, histref=histref)
1035-
elif weights is None and sample is not None:
1036-
g = dak_pwl(_blocked_dak, name, x, None, sample, histref=histref)
1037-
else:
1038-
g = dak_pwl(_blocked_dak, name, x, None, None, histref=histref)
1030+
f = partial(_blocked_dak, weights=weights, sample=sample, histref=histref)
1031+
g = dak_pwl(f, name, data[0])
10391032

10401033
# Single object, not a dataframe
10411034
elif len(data) == 1 and not data_is_df:

tests/test_boost.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,20 @@ def test_boost_output_pickles():
567567

568568
o = dask.compute(h)
569569
pickle.dumps(o)
570+
571+
572+
def test_155_boost_factory():
573+
import boost_histogram as bh
574+
575+
dak = pytest.importorskip("dask_awkward")
576+
import numpy as np
577+
578+
import dask_histogram as dh
579+
580+
arr = dak.from_lists([list(range(10))] * 3)
581+
axis = bh.axis.Regular(10, 0.0, 10.0)
582+
hist = dh.factory(
583+
arr,
584+
axes=(axis,),
585+
).compute()
586+
assert np.all(hist.values() == [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0])

0 commit comments

Comments
 (0)