Skip to content

Conversation

G26karthik
Copy link
Contributor

This PR adds a regression test for issue #61926, which was fixed by PR #62276.

Issue:
Merge operations were failing with ValueError: Length mismatch when using pyarrow datetime columns where the right dataframe had duplicate timestamps.

Fix:
PR #62276 improved Index._get_join_target to properly handle pyarrow datetime types by casting them to int64 (i8) for join operations, similar to how numpy datetime types are handled.

This PR:
Adds a test case to ensure this bug doesn't regress in the future. The test:

  • Creates two dataframes with pyarrow datetime columns
  • Left has 3 unique timestamps, right has 6 rows (each timestamp duplicated)
  • Performs a left merge that should return 6 rows
  • Validates the merge completes successfully without ValueError

Closes #61926

Add test for GH#61926 to ensure merge operations work correctly with
pyarrow datetime columns when there are duplicate values on the right
side. This was fixed by PR#62276 which improved Index._get_join_target
handling for pyarrow datetime types.
@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Oct 5, 2025
@G26karthik
Copy link
Contributor Author

@mroeschke Done! Removed the extra comments and switched to tm.assert_frame_equal. Thanks for the feedback!

@mroeschke mroeschke added this to the 3.0 milestone Oct 6, 2025
@mroeschke mroeschke merged commit 2bd5382 into pandas-dev:main Oct 6, 2025
42 checks passed
@mroeschke
Copy link
Member

Thanks @G26karthik

jzwick pushed a commit to jzwick/pandas that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Merge fails on pyarrow datetime columns
2 participants