-
Notifications
You must be signed in to change notification settings - Fork 62
feat!: reading JSON data as a custom arrow extension type #1458
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
Conversation
7f8d18c to
5dcbdc0
Compare
5dcbdc0 to
94ef33b
Compare
|
Getting some test failures in presubmit: Also, could we make sure we add a |
94ef33b to
5a2baa6
Compare
65770f3 to
a2edcbf
Compare
tswast
left a comment
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.
Thanks! One suggestion, but otherwise looks good.
bigframes/dtypes.py
Outdated
| GEO_DTYPE = gpd.array.GeometryDtype() | ||
| # JSON | ||
| JSON_DTYPE = db_dtypes.JSONDtype() | ||
| JSON_DTYPE = pd.ArrowDtype(db_dtypes.JSONArrowType()) |
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.
Should we switch to pd.ArrowDtype(pyarrow.json_(pyarrow.string())) if pyarrow.json_ is available?
Also, would be good to make sure we align with OBJ_REF_DTYPE by creating a JSON_ARROW_TYPE variable to use here and there.
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.
I will follow up with b/401055693. Thanks for reviewing!
We initially implemented a local pandas extension (
db_dtypes.JSONType) for handling JSON data. Subsequently, the Arrow project introduced a native JSON data type in pyarrow after v19.0. We've opted to adopt this native type as our primary solution (see go/bf-json2 for internal design document). To ensure compatibility for users with older pyarrow versions, we've been using a custom Arrow extension as a fallback. This change transitions to using this custom Arrow extension as a stepping stone towards fully integrating the native pyarrow JSON type.Release-As: 1.40.0
Fixes internal issue 401054811🦕