-
Notifications
You must be signed in to change notification settings - Fork 48
feat: enable local json string validations #1614
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
8f9e7bc
to
7dc54ae
Compare
3de56f1
to
6643f93
Compare
fbe0d40
to
f668cce
Compare
bigframes/core/local_data.py
Outdated
@@ -150,6 +151,38 @@ def validate(self): | |||
f"Field {bf_field} has arrow array type: {arrow_type}, expected type: {expected_arrow_type}" | |||
) | |||
|
|||
if include_context: |
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.
content, not context
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.
Fixed. Thanks for catching that.
values = array.to_pandas() | ||
for data in values: | ||
# Skip scalar null values to avoid `TypeError` from json.load. | ||
if not utils.is_list_like(data) and pd.isna(data): |
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.
Isn't everything a string or a null? how do you get a list-like?
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.
Now, the data is formatted using pyarrow storage, so these checks are no longer necessary. They are only required to handle values like None
, or []
in pandas.
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.
Re-adding null value checks to ensure compatibility with Python 3.9 tests.
bigframes/core/local_data.py
Outdated
@@ -329,3 +362,15 @@ def _physical_type_replacements(dtype: pa.DataType) -> pa.DataType: | |||
if dtype in _ARROW_MANAGED_STORAGE_OVERRIDES: | |||
return _ARROW_MANAGED_STORAGE_OVERRIDES[dtype] | |||
return dtype | |||
|
|||
|
|||
def _is_valid_json_series(s: pd.Series): |
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.
can drop this?
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.
Dropped.
3cea4f7
to
58e672a
Compare
58e672a
to
772e490
Compare
Fixes internal issue 401055880 🦕