Repository navigation
Conversation
Co-authored-by: Codex <noreply@openai.com>
|
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
Author
|
A note on CI: the two failing tests are Iris conversion tests and aren't related to this PR. The failing job resolved Iris 3.13.1 alongside All other executed CI jobs passed, so I have not changed the branch. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#8092 tracks two
Dataset.to_dask_dataframe()tests that fail when Dask converts string data to PyArrow-backed pandas strings. That conversion is intended Dask behaviour, not a bug in Xarray's production code. The tests were written on the assumption that strings are always object-backed, so their expected DataFrames no longer matched what Dask validly returns.This PR corrects the tests and removes the obsolete xfails. Both tests are now parametrized over Dask's
dataframe.convert-stringconfiguration:dataframe.convert-stringobjectstring[pyarrow]The two tests exercise slightly different paths: one covers a string column when a 2D dataset is flattened, while the other covers a string coordinate used as the DataFrame index. In both cases, I construct the expected DataFrame explicitly and keep the
assert_frame_equalchecks strict, including the string and numeric dtypes.I also use
raise_if_dask_computes()to make sure creating the DataFrame stays lazy. The Dask configuration is applied within a context manager so it is restored after each test, and the PyArrow-specific case uses Xarray's existingrequires_pyarrowmarker.No production code, API, documentation or user-visible behaviour is changed.
Validation: the four parametrized cases passed under pandas 2.3.3 and pandas 3.1.1. Validation also included the related conversion tests (9 passed, 1 unrelated xfail) and a full
test_dask.pyrun (222 passed, 6 skipped, 1 unrelated xfail). Ruff and pre-commit passed on the final patch.Checklist
AI Disclosure
Tools: Codex
Prompt summary: I asked Codex to investigate the two
Dataset.to_dask_dataframe()test failures reported in #8092 and determine whether they indicated a production bug or outdated test expectations. The requested change was limited toxarray/tests/test_dask.pyand needed to remain minimal and test-only.I asked it to remove the obsolete xfails, cover Dask string conversion with
dataframe.convert-stringboth enabled and disabled, and construct the expected DataFrames independently. The assertions needed to check the exact object-backed and PyArrow-backed string dtypes without usingcheck_dtype=False, while continuing to verify numeric dtypes, index values, names and ordering. I also asked it to confirm that conversion remained lazy, that temporary Dask configuration did not leak between tests, and that the existing unrelated MultiIndex xfail was unchanged.The validation requested included reproducing the original failures, testing the corrected cases with supported pandas 2.x and 3.x versions, running the related conversion tests and full Dask test module, and running Ruff and pre-commit. I subsequently asked Codex to perform a maintainer-level final review, verify that no competing fix had appeared, commit the reviewed patch with AI co-authorship attribution, and push only the contribution branch to my fork.