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

[SPARK-46761][SQL] Quoted strings in a JSON path should support ? characters #45420

Conversation

planga82
Copy link
Contributor

@planga82 planga82 commented Mar 7, 2024

What changes were proposed in this pull request?

If there is a JSON with a ? character in the key like

{"?":"QUESTION"}

This PR allow to add this character in the JSON path

get_json_object(json, '$['?']')

This character is now explicitly avoided in the regular expression but there seem to be no restrictions on this in the specification (https://goessner.net/articles/JsonPath/) and no tests fail with this change.

Why are the changes needed?

Improve the support of ? character in json parh

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit testing

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Mar 7, 2024
@MaxGekk
Copy link
Member

MaxGekk commented Mar 13, 2024

cc @HyukjinKwon

@HyukjinKwon
Copy link
Member

Merged to master.

sweisdb pushed a commit to sweisdb/spark that referenced this pull request Apr 1, 2024
…racters

### What changes were proposed in this pull request?

If there is a JSON with a ? character in the key like
```
{"?":"QUESTION"}
```

This PR allow to add this character in the JSON path
```
get_json_object(json, '$['?']')
```

This character is now explicitly avoided in the regular expression but there seem to be no restrictions on this in the specification (https://goessner.net/articles/JsonPath/) and no tests fail with this change.

### Why are the changes needed?

Improve the support of ? character in json parh

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Unit testing

### Was this patch authored or co-authored using generative AI tooling?

No

Closes apache#45420 from planga82/bugfix/spark46761_json_path_question_mark.

Authored-by: Pablo Langa <soypab@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants