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

Simplify HyperLogLog.update() #263

Merged
merged 1 commit into from
Nov 17, 2020
Merged

Simplify HyperLogLog.update() #263

merged 1 commit into from
Nov 17, 2020

Conversation

brainix
Copy link
Owner

@brainix brainix commented Nov 16, 2020

Previously, we were including self.key in other_hll_keys to be
merged in.

However, this is unnecessary, as we're saving the new HyperLogLog back
to self.key. And according to the official documentation:

The computed merged HyperLogLog is set to the destination variable,
which is created if does not exist (defaulting to an empty HyperLogLog).

If the destination variable exists, it is treated as one of the source
sets and its cardinality will be included in the cardinality of the
computed HyperLogLog.

For more info:
https://redis.io/commands/pfmerge

Previously, we were including `self.key` in `other_hll_keys` to be
merged in.

However, this is unnecessary, as we're saving the new HyperLogLog back
to `self.key`.  And according to the official documentation:

> The computed merged HyperLogLog is set to the destination variable,
> which is created if does not exist (defaulting to an empty HyperLogLog).

> If the destination variable exists, it is treated as one of the source
> sets and its cardinality will be included in the cardinality of the
> computed HyperLogLog.

For more info:
https://redis.io/commands/pfmerge
@brainix
Copy link
Owner Author

brainix commented Nov 17, 2020

🐟

@brainix brainix merged commit 982f7bc into master Nov 17, 2020
@brainix brainix deleted the simpler-hyperloglog-update branch November 17, 2020 00:10
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.

1 participant