You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@abslock128w there are no categoricals in this test.
It fails sporadically on all versions of pandas (but I can't reproduce it locally).
The above being said, feel free to open a PR if you believe you found the issue and know how to fix it.
@abslock128w there are no categoricals in this test. It fails sporadically on all versions of pandas (but I can't reproduce it locally). The above being said, feel free to open a PR if you believe you found the issue and know how to fix it.
I looked thru the issue.. this looks like a true flaky test caused by a mismatch between Dask metadata
and computed data.
len(df2.partitions[0]) relies on partition metadata and does not trigger
computation, while df2.partitions[0].compute() returns the actual pandas
DataFrame. In some execution paths, the metadata overestimates the partition
length (e.g. reporting 100 rows) while the computed result only contains 10
rows.
This explains the intermittent 100 == 10 failure. The test assumes that
partition metadata length always matches the computed length, but this is not
a guarantee Dask provides, especially after expression-based transformations
like `df[["x"]] + 1`.
I’m able to run the test locally and it passes, which is consistent with the
non-deterministic nature of the failure observed in CI.
will create a fix for this and check out if it still fails..
The test assumes that partition metadata length always matches the computed length, but this is not
a guarantee Dask provides
It definitely does provide this guarantee and many things would break if it didn't. metadata length must be either an integer that actually matches what will come out of the compute() or NaN/None/raise.
The test assumes that partition metadata length always matches the computed length, but this is not
a guarantee Dask provides
It definitely does provide this guarantee and many things would break if it didn't. metadata length must be either an integer that actually matches what will come out of the compute() or NaN/None/raise.
I agree that if the partition metadata says a concrete length, then it really has to match the computed result, otherwise a lot of downstream logic will break.
So this flakiness probably points more to a bug in how partition length metadata is inferred or passed around in dask_expr, especially after expression-based ops like df[["x"]] + 1, rather than a problem with the test itself.
I’ll take a closer look at where the partition length is coming from in this case and try to figure out why it sometimes becomes wrong.
In an earlier iteration, I tried using @pytest.mark.repeat. It doesn't work: when it flakes, it flakes 10 times in a row.
This makes me suspect that the issue may be caused by set ordering (which changes at every interpreter start).
Activity
abslock128w commentedon Feb 4, 2026
i could take a look at this
[-]Flaky[/-][+]Flaky `test_collection.py::test_len`[/+]crusaderky commentedon Feb 5, 2026
@abslock128w there are no categoricals in this test.
It fails sporadically on all versions of pandas (but I can't reproduce it locally).
The above being said, feel free to open a PR if you believe you found the issue and know how to fix it.
crusaderky commentedon Feb 5, 2026
@abslock128w did you mean to post on #12268?
abslock128w commentedon Feb 5, 2026
yeah my bad,
will try to find the fix for this and create PR
abslock128w commentedon Feb 5, 2026
I looked thru the issue.. this looks like a true flaky test caused by a mismatch between Dask metadata
and computed data.
len(df2.partitions[0])relies on partition metadata and does not triggercomputation, while
df2.partitions[0].compute()returns the actual pandasDataFrame. In some execution paths, the metadata overestimates the partition
length (e.g. reporting 100 rows) while the computed result only contains 10
rows.
This explains the intermittent
100 == 10failure. The test assumes thatpartition metadata length always matches the computed length, but this is not
a guarantee Dask provides, especially after expression-based transformations
like
`df[["x"]] + 1`.I’m able to run the test locally and it passes, which is consistent with the
non-deterministic nature of the failure observed in CI.
will create a fix for this and check out if it still fails..
crusaderky commentedon Feb 5, 2026
It definitely does provide this guarantee and many things would break if it didn't. metadata length must be either an integer that actually matches what will come out of the compute() or NaN/None/raise.
abslock128w commentedon Feb 5, 2026
I agree that if the partition metadata says a concrete length, then it really has to match the computed result, otherwise a lot of downstream logic will break.
So this flakiness probably points more to a bug in how partition length metadata is inferred or passed around in dask_expr, especially after expression-based ops like df[["x"]] + 1, rather than a problem with the test itself.
I’ll take a closer look at where the partition length is coming from in this case and try to figure out why it sometimes becomes wrong.
abslock128w commentedon Feb 13, 2026
@crusaderky Could you take a look at this PR when you have time? It addresses the flaky test_len failure Thanks!
crusaderky commentedon May 14, 2026
XFAIL'ed in #12396
In an earlier iteration, I tried using
@pytest.mark.repeat. It doesn't work: when it flakes, it flakes 10 times in a row.This makes me suspect that the issue may be caused by set ordering (which changes at every interpreter start).