Example usage for org.apache.hadoop.util.bloom Filter or

List of usage examples for org.apache.hadoop.util.bloom Filter or

Introduction

In this page you can find the example usage for org.apache.hadoop.util.bloom Filter or.

Prototype

public abstract void or(Filter filter);

Source Link

Document

Peforms a logical OR between this filter and a specified filter.

Usage

From source file:brickhouse.udf.bloom.BloomOrUDF.java

License:Apache License

public String evaluate(String bloom1Str, String bloom2Str) throws IOException {
    Filter bloom1 = BloomFactory.GetBloomFilter(bloom1Str);
    Filter bloom2 = BloomFactory.GetBloomFilter(bloom2Str);

    bloom1.or(bloom2);

    return BloomFactory.WriteBloomToString(bloom1);
}

From source file:hivemall.sketch.bloom.BloomOrUDF.java

License:Apache License

@Nullable
public Text evaluate(@Nullable Text bloom1Str, @Nullable Text bloom2Str) throws HiveException {
    if (bloom1Str == null || bloom2Str == null) {
        return null;
    }/* w w w. j a  v  a 2 s  . c  o  m*/

    final Filter bloom1;
    final Filter bloom2;
    try {
        bloom1 = BloomFilterUtils.deserialize(bloom1Str, new DynamicBloomFilter());
        bloom2 = BloomFilterUtils.deserialize(bloom2Str, new DynamicBloomFilter());
    } catch (IOException e) {
        throw new HiveException(e);
    }

    bloom1.or(bloom2);

    try {
        return BloomFilterUtils.serialize(bloom1, new Text());
    } catch (IOException e) {
        throw new HiveException(e);
    }
}