Pronghorn
  • Welcome to the Pronghorn docs!
  • Overview
    • Home
    • Downloads
    • FAQs
    • Features
    • Benchmarks
  • Chapter 0: JavaDoc
    • Pronghorn
    • PronghornPipes
    • JPG-Raster
  • Chapter 1: Getting Started with Pronghorn
    • What you need
    • Hello World Example
      • Getting Started
      • The Message
      • The Producer
      • The Stage
      • Connecting the Dots
      • Bonus: Telemetry
  • Chapter 2: Schemas
    • Defining Schemas
  • Chapter 3: Stages
    • Building Stages
    • Notas
  • Chapter 4: APIs
    • Writing to Pipes
  • Chapter 5: Utility Classes
    • Appendables
    • Bloom Filter
    • Trie Parser
  • Chapter 6: Example Projects
    • JPG-Raster
    • Web Cookbook
Powered by GitBook
On this page
  • Usage
  • Example
  1. Chapter 5: Utility Classes

Bloom Filter

PreviousAppendablesNextTrie Parser

Last updated 6 years ago

A Bloom Filter (located in Pronghorn) is a space-efficient probabilistic data structure used in Pronghorn for fast data lookup.

Pronghorn uses for its hash-based lookups.

Usage

BloomFilter filter = new BloomFilter(n, p);
BloomFilter filter = new BloomFilter(template); // alternative
BloomFilter filter = new BloomFilter(a, b, intersection); // alternative
  • n is the number of items in the filter

  • p is the probability of false positives, float between 0 and 1 or a number indicating 1-in-p

  • template is a previous BloomFilter that you can re-use

  • a and b are previous bloom filters for intersection checking

  • intersection determines if there is an intersection

Example

String[] messages = new String[] { "Moe", "Larry", "Curley" };
BloomFilter filter = new BloomFilter(1000, .00000001);

//build up the filter with the known values.
int i = messages.length;
while (--i>=0) {
    filter.addValue(messages[i]);
}

//check if it contains
if(filter.mayContain(messages[0])) {
    //do something
}
MurmurHash