Skip to content
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

Add support for parsing boolean values in from_json #9620

Merged
merged 23 commits into from
Nov 7, 2023

Conversation

andygrove
Copy link
Contributor

@andygrove andygrove commented Nov 2, 2023

Closes #9597

Changes in this PR:

  • Add support for parsing boolean values in from_json

@andygrove andygrove changed the title [WIP] Add support for parsing boolean values in from_json Add support for parsing boolean values in from_json Nov 6, 2023
@andygrove andygrove marked this pull request as ready for review November 6, 2023 19:57
@andygrove
Copy link
Contributor Author

build

@pytest.mark.parametrize('pattern', [
r'{ "bool": [truefalsTRUEFALS]{1,5} }',
r'{ "bool": "[truefalsTRUEFALS]{1,5}" }',
pytest.param(r'{ "bool": [0-9]{0,2}(\.[0-9]{1,2})? }', marks=pytest.mark.xfail(reason='TBD')),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need an actual issue for this, not just TBD

.with_special_pattern('null', weight=50)
@pytest.mark.parametrize('pattern', [
r'{ "bool": [truefalsTRUEFALS]{1,5} }',
r'{ "bool": "[truefalsTRUEFALS]{1,5}" }',
Copy link
Collaborator

Choose a reason for hiding this comment

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

So what is the probability that this actually shows up as "true" or "false"? I think it has to be worse than 1 out of 524288 rows 2/(16^5) because that would be the probability for {5} at the end, but it is {1,5}. Those values should be returned as null because a quoted string should not be interpreted as a boolean, but I don't think this code is doing that. I could be wrong though, but the probabilities don't give me a lot of comfort that we have covered that test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the tests and added a link to the issue

@revans2
Copy link
Collaborator

revans2 commented Nov 7, 2023

build

@andygrove andygrove self-assigned this Nov 7, 2023
@andygrove andygrove merged commit a79d0d1 into NVIDIA:branch-23.12 Nov 7, 2023
37 checks passed
@andygrove andygrove deleted the from_json_bool branch November 7, 2023 21:07
@sameerz sameerz added the feature request New feature or request label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA][JSON] Support boolean type in from_json
3 participants