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 command JSON.ARRAPPEND #485

Closed
arpitbbhayani opened this issue Sep 8, 2024 · 6 comments · Fixed by #543
Closed

Add support for command JSON.ARRAPPEND #485

arpitbbhayani opened this issue Sep 8, 2024 · 6 comments · Fixed by #543
Assignees

Comments

@arpitbbhayani
Copy link
Contributor

arpitbbhayani commented Sep 8, 2024

Add support for the JSON.ARRAPPEND command in DiceDB similar to the JSON.ARRAPPEND command in Redis. Please refer to the following commit in Redis to understand the implementation specifics - source.

Write unit and integration tests for the command referring to the tests written in the Redis codebase 7.2.5. For integration tests, you can refer to the tests folder. Note: they have used TCL for the test suite, and we need to port that to our way of writing integration tests using the relevant helper methods. Please refer to our tests directory.

For the command, benchmark the code and measure the time taken and memory allocs using benchmem and try to keep them to the bare minimum.

@raghavbabbar
Copy link
Contributor

raghavbabbar commented Sep 8, 2024

could you please assign this to me @arpitbbhayani

@arpitbbhayani
Copy link
Contributor Author

@raghavbabbar you already have a few on your plate, once you wrap that you can pick this one. trying to be fair here to others :) but thank you so much for being so eager.

@srivastava-yash
Copy link
Contributor

@arpitbbhayani, I can pick this up. could you assign this to me?

@lucifercr07
Copy link
Contributor

@srivastava-yash assigned, thanks for picking this up.

@srivastava-yash
Copy link
Contributor

@lucifercr07 @JyotinderSingh Quick question: So in JSON.ARRAPPEND we want to append to a list at a given path, so should I check the type of the fields that are already there in the array and then convert this value in the argument to the same type and only then append, right?
Or should I just append it assuming the user knows what they are appending? Either I can just run a sonic.UnmarshalString on the arg and just append. What do you suggest? Nothing was mentioned in the redis doc about it, maybe I can try finding it in their code

@JyotinderSingh
Copy link
Collaborator

@lucifercr07 @JyotinderSingh Quick question: So in JSON.ARRAPPEND we want to append to a list at a given path, so should I check the type of the fields that are already there in the array and then convert this value in the argument to the same type and only then append, right?

Or should I just append it assuming the user knows what they are appending? Either I can just run a sonic.UnmarshalString on the arg and just append. What do you suggest? Nothing was mentioned in the redis doc about it, maybe I can try finding it in their code

You need to check the type of object already present at any path which you'd like to modify. If the object doesn't match the expected type you'll return an error. Ensure that test cases validating this behavior are also added.
Additionally, run the same commands on a redis instance (redis docs pages have an embedded cli to run redis commands) and ensure the results (including error responses) are consistent.

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 a pull request may close this issue.

5 participants