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

feat: allow querying of json objects stored as strings #4399

Merged
merged 1 commit into from
Jan 6, 2025
Merged

feat: allow querying of json objects stored as strings #4399

merged 1 commit into from
Jan 6, 2025

Conversation

romange
Copy link
Collaborator

@romange romange commented Jan 3, 2025

No description provided.

Copy link
Collaborator

@chakaz chakaz left a comment

Choose a reason for hiding this comment

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

Maybe add a unit test?

Copy link
Contributor

@BagritsevichStepan BagritsevichStepan left a comment

Choose a reason for hiding this comment

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

What are we trying to achieve here? As I understand from the issue submitted by the user, they will store JSON just as blob strings. In this case, the basic GET command will be used to get the JSON blob.

Also, we are converting the blob string into JsonType here. Can you confirm that the reordering of elements does not occur after this conversion?

Redis does not support this behavior:

127.0.0.1:6379> SET mykey '{"name": "John", "age": 30}'
OK
127.0.0.1:6379> JSON.GET mykey
(error) Existing key has wrong Redis type

And still other JSON commands are not supported.

@romange
Copy link
Collaborator Author

romange commented Jan 6, 2025

Yes, it's an extra behavior that allows some runtime flexibility - a user can query strings that hold json objects. The main thing - it extends Redis behavior, so I do not see a problem here.
The ordering issue stays with JSON.GET of course, but now a user can fetch parts of the object, not the whole string, or use GET to fetch the string as is.

@BagritsevichStepan
Copy link
Contributor

BagritsevichStepan commented Jan 6, 2025

Yes, it's an extra behavior that allows some runtime flexibility - a user can query strings that hold json objects. The main thing - it extends Redis behavior, so I do not see a problem here. The ordering issue stays with JSON.GET of course, but now a user can fetch parts of the object, not the whole string, or use GET to fetch the string as is.

Are we going to support all other JSON.* commands for blob strings?

@romange
Copy link
Collaborator Author

romange commented Jan 6, 2025

I think we may support additional read only commands but for now I would not rush to do so. Lets wait to see if community finds it useful.

@romange romange merged commit 21fcf58 into main Jan 6, 2025
9 checks passed
@romange romange deleted the Pr3 branch January 6, 2025 19:20
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

Successfully merging this pull request may close these issues.

3 participants