Skip to content

fix:Dataframe.merge loses data when there are 128 or 129 partitions - #12430

Merged
crusaderky merged 6 commits into
dask:mainfrom
hebian1994:fix-partitioning-index-int8-overflow
Jun 6, 2026
Merged

crusaderky merged 6 commits into
dask:mainfrom
hebian1994:fix-partitioning-index-int8-overflow

Conversation

@hebian1994

Copy link
Copy Markdown
Contributor

Summary

  • Fix partitioning_index choosing int8 when npartitions=129, causing partition 128 to be stored as -128 and rows to be silently dropped during P2P shuffle routing.

Root cause

np.min_scalar_type(-(npartitions - 1)) picks int8 for 129 partitions because -128 fits in int8, but the logical bucket 128 cannot be represented as a non-negative int8.
Fixes #12427

Test plan

  • pytest dask/dataframe/tests/test_shuffle.py -k partitioning_index

@github-actions

github-actions Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

     25 files  +     1       25 suites  +1   6h 55m 25s ⏱️ + 20m 31s
 18 642 tests +     4   17 452 ✅ +     4   1 190 💤 ±    0  0 ❌ ±0 
379 045 runs  +18 517  331 801 ✅ +17 290  47 244 💤 +1 227  0 ❌ ±0 

Results for commit 867df83. ± Comparison against base commit 9124454.

♻️ This comment has been updated with latest results.

@crusaderky crusaderky mentioned this pull request Jun 5, 2026
1 task
@crusaderky

Copy link
Copy Markdown
Collaborator

The issue is not when there are more than 128 partitions.
It's when there are exactly 128, 129, 32768, or 32769 partitions.
(nobody on Earth will ever reach 2**31 partitions).

I've simplified the PR and updated the title.

Thank you!

@crusaderky crusaderky changed the title fix:Dataframe.merge loses data when there are more than 128 partitions fix:Dataframe.merge loses data when there are 128 or 129 partitions Jun 6, 2026
@crusaderky
crusaderky merged commit f8e1de3 into dask:main Jun 6, 2026
32 of 33 checks passed
@hebian1994
hebian1994 deleted the fix-partitioning-index-int8-overflow branch June 7, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dataframe.merge loses data when there are more than 128 partitions

3 participants