-
Notifications
You must be signed in to change notification settings - Fork 312
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: avoid "Unable to determine type" warning with JSON columns in to_dataframe
#1876
base: tswast-refactor-cell-data
Are you sure you want to change the base?
Conversation
I might actually want to do something in |
Right now the behavior is inconsistent across REST and BQ Storage API. |
Marking as |
Actually, I think this needs a few more tests. I'm testing manually with |
# Prefer JSON type built-in to pyarrow (adding in 19.0.0), if available. | ||
# Otherwise, fallback to db-dtypes, where the JSONArrowType was added in 1.4.0, | ||
# but since they might have an older db-dtypes, have string as a fallback for that. | ||
# TODO(https://github.com/pandas-dev/pandas/issues/60958): switch to | ||
# pyarrow.json_(pyarrow.string()) if available and supported by pandas. | ||
if hasattr(db_dtypes, "JSONArrowType"): | ||
json_arrow_type = db_dtypes.JSONArrowType() | ||
else: | ||
json_arrow_type = pyarrow.string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key change. Mostly aligns with bigframes, but we've left off pyarrow.json_(pyarrow.string())
because of pandas-dev/pandas#60958.
Marking as Edit: Mailed #2144 |
TODO:
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #1580 (TODO: need test case for empty result set)
🦕