Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

feat: enable local json string validations#1614

Merged
chelsea-lin merged 4 commits intomainfrom
main_chelsealin_jsonlocalvalid
Apr 18, 2025
Merged

feat: enable local json string validations#1614
chelsea-lin merged 4 commits intomainfrom
main_chelsealin_jsonlocalvalid

Conversation

@chelsea-lin
Copy link
Copy Markdown
Contributor

Fixes internal issue 401055880 🦕

@chelsea-lin chelsea-lin requested review from a team and TrevorBergeron April 12, 2025 05:05
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Apr 12, 2025
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. label Apr 12, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_jsonlocalvalid branch 2 times, most recently from 8f9e7bc to 7dc54ae Compare April 12, 2025 05:19
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: m Pull request size is medium. labels Apr 12, 2025
@GarrettWu GarrettWu removed their assignment Apr 15, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_jsonlocalvalid branch 3 times, most recently from 3de56f1 to 6643f93 Compare April 17, 2025 21:21
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Apr 17, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_jsonlocalvalid branch 2 times, most recently from fbe0d40 to f668cce Compare April 17, 2025 21:31
@chelsea-lin chelsea-lin added the kokoro:run Add this label to force Kokoro to re-run the tests. label Apr 17, 2025
Comment thread bigframes/core/local_data.py Outdated
f"Field {bf_field} has arrow array type: {arrow_type}, expected type: {expected_arrow_type}"
)

if include_context:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content, not context

Copy link
Copy Markdown
Contributor Author

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):
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

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.

Comment thread bigframes/core/local_data.py Outdated
return dtype


def _is_valid_json_series(s: pd.Series):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can drop this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped.

@bigframes-bot bigframes-bot removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Apr 17, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_jsonlocalvalid branch from 3cea4f7 to 58e672a Compare April 17, 2025 23:10
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_jsonlocalvalid branch from 58e672a to 772e490 Compare April 18, 2025 16:36
@chelsea-lin chelsea-lin merged commit 233347a into main Apr 18, 2025
23 of 24 checks passed
@chelsea-lin chelsea-lin deleted the main_chelsealin_jsonlocalvalid branch April 18, 2025 17:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants