-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ft: Add support for PFDEBUG command #1216
base: master
Are you sure you want to change the base?
ft: Add support for PFDEBUG command #1216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this change. There are some merge conflicts, could you please resolve them? Also, please add tests for the commands you have added.
internal/eval/eval.go
Outdated
} | ||
|
||
sparseField := reflect.ValueOf(hll).Elem().FieldByName("sparseList") | ||
sparseFieldValue := reflect.NewAt(sparseField.Type(), unsafe.Pointer(sparseField.UnsafeAddr())).Elem() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can avoid usage of unsafe pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing we can do, convert the hyperloglog structure to binary, the third byte is 0/1 depending on sparse/dense notation. I'll use that instead.
internal/eval/eval.go
Outdated
|
||
obj := store.Get(key) | ||
if obj == nil { | ||
return diceerrors.NewErrWithMessage("Key does not exist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should match the message returned by redis, and ideally be defined as a constant string in the constants file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, matches the message. Will define as constant
internal/eval/eval.go
Outdated
} | ||
|
||
switch subcommand { | ||
case "GETREG": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a constant to define this string in the constants file. Same for other cases.
internal/eval/eval.go
Outdated
// For call to GETREG, encoding is converted from sparse to dense. | ||
// We'll merge a sparse and an empty dense HLL to get a dense HLL | ||
// with values of sparse HLL. | ||
if encoding == "sparse" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define this string in a constant. It would also be good to be consistent with the casing of these constants.
…upport-for-hll-debug-commands
Hi @neverwannafly , Thanks for addressing the comments. Could you please rebase the PR and re-request for review? Thanks |
Description
This PR adds support for
PFDEBUG
command in dicedb.Progress