Skip to content

Conversation

@cosmicBboy
Copy link
Collaborator

@cosmicBboy cosmicBboy commented Jun 4, 2025

Fixes #2017

This PR addresses a issue where Engine.register_dtype equivalents entries would be overridden due to numpy and pandas behavior where dtypes would evaluate to True if they are equal to the string representation of the dtype, e.g. np.dtype("int64") == "int64".

This led to the mapping of pyarrow[string] -> pd.StringDtype() to being overridden by pd.ArrowDtype(pyarrow.string()).

This PR fixes this by:

Introducing a StrictEquivalent dataclass to make sure that specific registered datatype equivalents are registered under a strict_equivalents registry that keeps track of both the type value and its underlying type so that the problem articulated above doesn't happen.

Signed-off-by: cosmicBboy <[email protected]>
Signed-off-by: cosmicBboy <[email protected]>
Signed-off-by: cosmicBboy <[email protected]>
Signed-off-by: cosmicBboy <[email protected]>
Signed-off-by: cosmicBboy <[email protected]>
Signed-off-by: Niels Bantilan <[email protected]>
Signed-off-by: Niels Bantilan <[email protected]>
@cosmicBboy cosmicBboy changed the title fix pyarrow string issue fix pyarrow string issue, fix docs failing issues Jun 4, 2025
@cosmicBboy cosmicBboy merged commit 47f0b0b into main Jun 4, 2025
188 checks passed
@cosmicBboy cosmicBboy deleted the bugfix/2017-pyarrow-string branch June 5, 2025 00:01
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.

Validation of pandas dataframe column of "string[pyarrow]" dtype fails

2 participants