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

optimise json_get(...) is null to json_contains_not_null(...) #28

Open
samuelcolvin opened this issue Jul 9, 2024 · 2 comments
Open

Comments

@samuelcolvin
Copy link
Collaborator

samuelcolvin commented Jul 9, 2024

We can't replace json_get(x, y) is null with NOT json_contains(x, y) because

select json_get('{"foo": null}', 'foo') is null  -- true
select not json_contains('{"foo": null}', 'foo')  -- false
-- or equivilantly
select json_get('{"foo": null}', 'foo') is not null  -- false
select json_contains('{"foo": null}', 'foo')  -- true

So we need a new method json_contains_not_null which is true if the value exists in the JSON, but is not null.

Then we can do the substitution.

@davidhewitt
Copy link
Collaborator

What about a json_get_default(D, x, y) or similar which allows for json_get_default(false, x, y) is null?

@samuelcolvin
Copy link
Collaborator Author

But that will still require an intermediate vec before this is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants