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

Added Aggregators for BloomFilter, CountMinSketch, MapSketch, HyperLogLog, Moments, Min, Max #194

Merged
merged 5 commits into from
Sep 30, 2013

Conversation

stephanh
Copy link
Contributor

@stephanh stephanh commented Sep 2, 2013

Added Aggregators for BloomFilter, CountMinSketch, MapSketch, HyperLogLog, Moments, Min, Max with some testing. Are there any other classes that should also have aggregators added?

This should address #190.

val monoid = hllMonoid

def prepare(value: Array[Byte]) = monoid.create(value)
def present(hll: HLL) = hll
Copy link
Contributor

Choose a reason for hiding this comment

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

Does present want to be the HLL here, or the estimate? I can see arguments either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the estimate would be the nicer output but I'm not actually using HLL so I don't know how useful others would find having the actual HLL instance.

@johnynek
Copy link
Collaborator

Nice work. Really appreciate this! Make a few return types and I'll merge.

}
}

case class HyperLogLogAggregator(val hllMonoid: HyperLogLogMonoid) extends MonoidAggregator[Array[Byte], HLL, Double] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We often store the HLL. Let's keep the HLL as the return type and if you want size you can use

.andThenPresent(_.estimateSize)

to get it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you also want a size estimating one, that's fine, HLLSizeAggregator or something, so you don't have to do the above andThen over and over.

@johnynek
Copy link
Collaborator

Looks good. Thanks!

johnynek added a commit that referenced this pull request Sep 30, 2013
Added Aggregators for BloomFilter, CountMinSketch, MapSketch, HyperLogLog, Moments, Min, Max
@johnynek johnynek merged commit fcf005e into twitter:develop Sep 30, 2013
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.

3 participants