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

#499: Add support for command JSON.OBJLEN #593

Merged
merged 14 commits into from
Sep 17, 2024

Conversation

phaneesh707
Copy link
Contributor

@phaneesh707 phaneesh707 commented Sep 15, 2024

Issue

Issue fixed : #499

Description

This PR introduces the new command JSON.OBJLEN

  1. Implementation for JSON.OBJLEN ref: RedisJSON , JSON.OBJLEN
  2. Add unit tests
  3. Add integration tests
  4. Add benchmark

Dice DB(CLI demo)
Screenshot 2024-09-16 at 2 10 54 AM

Redis
Screenshot 2024-09-16 at 2 11 45 AM

Testing details

  1. Units tests
Screenshot 2024-09-16 at 1 13 59 AM
  1. Integration tests
Screenshot 2024-09-16 at 1 16 50 AM
  1. Benchmarks
Screenshot 2024-09-16 at 1 26 08 AM

Copy link
Contributor

@lucifercr07 lucifercr07 left a comment

Choose a reason for hiding this comment

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

@phaneesh707 thanks for contributing, have some minor comments. Please have a look once.

// Retrieve the object from the database
obj := store.Get(key)
if obj == nil {
return diceerrors.NewErrWithMessage("Path '.' does not exist or not a json")
Copy link
Contributor

Choose a reason for hiding this comment

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

. is not an invalid path. We should return the length of complete parent object if the arg contains . as path.

127.0.0.1:6379> JSON.OBJLEN doc .
(integer) 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So when i use JSON.OBJLEN doc . the library is not able to parse it , gives this error - ERRR not terminated at 2 in . , but it works fine for JSON.OBJLEN doc .person or something similar.so should i just do this ?

if path == "."{
    path = "$"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lucifercr07 any suggestion for ^^??

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's tackle this separately. Created issue #603 for this

@JyotinderSingh JyotinderSingh self-requested a review September 17, 2024 02:06
Copy link
Collaborator

@JyotinderSingh JyotinderSingh left a comment

Choose a reason for hiding this comment

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

Thanks for these changes @phaneesh707. I have left a few comments.

@JyotinderSingh JyotinderSingh merged commit 0bd3945 into DiceDB:master Sep 17, 2024
2 checks passed
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.

Add support for command JSON.OBJLEN
3 participants