in page https://redis.io/commands/pfmerge/ syntax section is PFMERGE destkey sourcekey [sourcekey ...]
So, this example may be failed:
pfadd website:visitors:/article1 1 2 3 4
pfadd website:visitors:/article2 1 2 5 7
pfadd website:visitors:/article3 11 12 4
pfmerge website:allArticleVisitors
# fail here, because at least one sourcekey needed
But, pfmerge website:allArticleVisitors return OK , and pfcount return 0, so real syntax is rather PFMERGE destkey [sourcekey ...]
Comment From: itamarhaber
Hi @dozer111
Thanks for raising this issue. I agree this is a problem, but I feel that in this case, the implementation is wrong.
The current, when called with no source keys, creates an empty destkey HLL. I can't think of valid use case for that behavior, so I'd opt to fix the command so it returns an error (arity) when invoked in this manner.
Transferring this issue to the project's repository for resolution.
Comment From: itamarhaber
Also, I see that PFMERGE silently ignores non-existing source keys, so even if we set the commands arity to -3 (instead of the current -2) it will still be possible to create an empty destkey.
Comment From: enjoy-binbin
yes, this looks like a bug, we should return an arity error in this case and return an error on non-existing source keys case (or return OK, but do not create the empty destkey, a little bit odd)
Comment From: enjoy-binbin
But, pfmerge website:allArticleVisitors return OK , and pfcount return 0, so real syntax is rather PFMERGE destkey [sourcekey ...]
sorry for the delay, you are right, the source key is optional, see #11205 for more details