-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
JSONExtract String or Raw #25452
JSONExtract String or Raw #25452
Conversation
The changes also affect SELECT JSONExtractKeysAndValues('{"a": "string", "b": [1, 2]}', 'String') = [('a','string'),('b','[1,2]')] Do we really want such behaviour? |
Looks ok to me) |
Ok, let's fix tests and merge it |
fe44218
to
0adad24
Compare
The main problem in that implementation is ambiguity of
And lack of possibility to extract string field with surrounding quotes (to have always valid sub-json, which can be parsed) It is rather minor issue, but it potentially is not 100% sane, and once it will be merged we will not be able to fix it anymore in any other way. String will always extract raw-json. |
@filimonov This is what JSONExtractRaw for. |
Check #25414 |
@filimonov maybe you have an idea how to solve this ambiguity? One of the possible solution is to add new data type RawString, but this is overkill I think. |
It's also possible to give a different name like |
Nothing much smarter than:
Sounds like overkill, agree.
Theoretically it's bit safer (no regressions like in example below). But i also don't feel 100% happy about that (more functions / switches again)
For ex. things like
|
@Mergifyio update |
Command
|
That needs a clear documentation. Also a note in changelog. |
This change does not affect JSONExtractString(). Could we keep same behavior in all JSONExtract String function? @amosbird |
@wangqinghuan Yes. It's reasonable. #30426 |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Allow extract non-string element as string using JSONExtract. This is for #25414
Detailed description / Documentation draft:
.