• Hadoop Bloom Filter 使用


    1.Bloom Filter  默认的

        BloomFilter filter =new BloomFilter(10,2,1); // 过滤器长度为10 ,用2哈希函数,MURMUR_HASH (1)
        Key  key  =new Key("hadoop".getBytes());
        filter.add(key);
        Key hb  = new Key("hbase".getBytes());
        boolean has  =filter.membershipTest(key);
        System.out.println(has);
        System.out.println(filter.membershipTest(hb));

    2 CountingBloomFilter   可以增加删除key

         CountingBloomFilter filter =new CountingBloomFilter(10,2,1); // 过滤器长度为10 ,用2哈希函数,MURMUR_HASH (1)
            Key  key  =new Key("hadoop".getBytes());
            filter.add(key);
            Key hb  = new Key("hbase".getBytes());
            boolean has  =filter.membershipTest(key);
            System.out.println(has);
            System.out.println(filter.membershipTest(hb));

    3 .DynamicBloomFilter  过滤器长度可以扩容。

         DynamicBloomFilter      filter  =new DynamicBloomFilter(10,2,1,0);   0  表示不扩容。 10 ,表示 默认长度为为10 ;2 两个hash函数。1 表示MURMUR_HASH (1)
        Key  key  =new Key("hadoop".getBytes());
        filter.add(key);
        Key hb  = new Key("hbase".getBytes());
        boolean has  =filter.membershipTest(key);
        System.out.println(has);
        System.out.println(filter.membershipTest(hb));

  • 相关阅读:
    分页查询
    web 开发中 405报错
    html 中input标签的name属性
    怎么样利用debug
    bzoj 1314: River过河 优先队列
    bzoj 4004: [JLOI2015]装备购买 拟阵 && 高消
    bzoj 1133: [POI2009]Kon dp
    bzoj 4127: Abs 树链剖分
    bzoj 2406: 矩阵 上下界网络流判定
    再写FFT模板
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6205155.html
Copyright © 2020-2023  润新知