Skip to content

Commit

Permalink
add a user warning to eager len calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrommyd committed Nov 14, 2023
1 parent fa07194 commit 4057b61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,12 @@ def repartition(

def __len__(self) -> int:
if not self.known_divisions:
warnings.warn(
"The divisions of this collection are unknown.\n"
"An eager computation of the divisions will be performed. "
"This may be expensive.",
UserWarning,
)
self.eager_compute_divisions()
return self.divisions[-1] # type: ignore

Expand Down

0 comments on commit 4057b61

Please sign in to comment.