Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix upstream dev issues #9953

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Conversation

kmuehlbauer
Copy link
Contributor

@kmuehlbauer kmuehlbauer commented Jan 16, 2025

@kmuehlbauer kmuehlbauer added the run-upstream Run upstream CI label Jan 16, 2025
@kmuehlbauer kmuehlbauer marked this pull request as ready for review January 16, 2025 14:15
@@ -579,20 +579,23 @@ def _numbers_to_timedelta(
) -> np.ndarray:
"""Transform numbers to np.timedelta64."""
# keep NaT/nan mask
nan = np.isnan(flat_num) | (flat_num == np.iinfo(np.int64).min)
if flat_num.dtype.kind == "f":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit more explicit. The asarray-wrapping is needed for upstream-dev to keep 0d-arrays an array.


# in case we need to change the unit, we fix the numbers here
# this should be safe, as errors would have been raised above
ns_time_unit = _NS_PER_TIME_DELTA[time_unit]
ns_ref_date_unit = _NS_PER_TIME_DELTA[ref_unit]
if ns_time_unit > ns_ref_date_unit:
flat_num *= np.int64(ns_time_unit / ns_ref_date_unit)
flat_num = np.asarray(flat_num * np.int64(ns_time_unit / ns_ref_date_unit))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For pandas 3.0 CoW (copy on write) this array might be flagged readonly. So creating a copy here. The asarray-wrapping is needed for upstream-dev to keep 0d-arrays an array.

@kmuehlbauer kmuehlbauer changed the title fix pandas upstream dev issues fix upstream dev issues Jan 17, 2025
Copy link
Member

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice @kmuehlbauer, thanks—great that pandas 3 will convert datetime.datetime objects to microsecond-resolution np.datetime64 values.

The upstream build failure with the latest commit looks to be unrelated—a hopefully transient issue installing NumPy—and it passed with the commit prior.

@kmuehlbauer kmuehlbauer added the plan to merge Final call for comments label Jan 17, 2025
@kmuehlbauer
Copy link
Contributor Author

Thanks for checking @spencerkclark. I'll merge later today, if no one beats me to it.

@kmuehlbauer
Copy link
Contributor Author

@pydata/xarray There is something strange going on wrt to the failing test (linux/macos py 3.12):

ERROR xarray/tests/test_distributed.py::test_dask_distributed_zarr_integration_test[True-True]
 - Failed: 5 thread(s) were leaked from test

This surfaced some days ago, first only on linux then also on macos. Since many things have changed in the recent days (ubuntu-latest 22.04-> 24.04, zarr 2 -> zarr 3 with dependency change) this is very difficult to debug.

As everything works well for our upstream-dev, it really looks like an upstream issue which was already fixed in the dev versions. Another reason might be some inconsistent conda dependencies which would equally painful to debug.

@kmuehlbauer
Copy link
Contributor Author

Going to merge now, to unblock the upstream-dev runs again (and nightly run).

@kmuehlbauer kmuehlbauer merged commit 5761de6 into pydata:main Jan 17, 2025
27 of 35 checks passed
@kmuehlbauer kmuehlbauer deleted the fix-pandas3-issues branch January 17, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plan to merge Final call for comments run-upstream Run upstream CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚠️ Nightly upstream-dev CI failed ⚠️
2 participants