Skip to content

Catch shape issues for histogram filling before compute time #167

@alexander-held

Description

@alexander-held

The following example fails at dask.compute time due to the array being used to fill the histogram not being flattened:

import uproot
import hist.dask


evts = uproot.dask({"https://github.com/scikit-hep/coffea/raw/refs/heads/master/tests/samples/nano_dy.root": "Events"})
res = hist.dask.Hist.new.Regular(10, 0, 10).Double().fill(evts["Jet_pt"])
res.compute()

After conversation with @lgray I believe this could (ideally should?) already be caught earlier to avoid a runtime error. The ultimate exception that is raised currently is:

ValueError: cannot convert to RegularArray because subarray lengths are not regular (in compiled code: https://github.com/scikit-hep/awkward/blob/awkward-cpp-44/awkward-cpp/src/cpu-kernels/awkward_ListOffsetArray_toRegularArray.cpp#L22)

environment:

Package            Version
------------------ -----------
awkward            2.7.4
awkward_cpp        44
boost-histogram    1.5.1
dask               2025.1.0
dask-awkward       2025.2.0
dask-histogram     2025.2.0
hist               2.8.0
uproot             5.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions