List of usage examples for org.apache.hadoop.util.bloom Filter and
public abstract void and(Filter filter);
From source file:brickhouse.udf.bloom.BloomAndUDF.java
License:Apache License
public String evaluate(String bloom1Str, String bloom2Str) throws IOException { Filter bloom1 = BloomFactory.GetBloomFilter(bloom1Str); Filter bloom2 = BloomFactory.GetBloomFilter(bloom2Str); bloom1.and(bloom2); return BloomFactory.WriteBloomToString(bloom1); }
From source file:hivemall.sketch.bloom.BloomAndUDF.java
License:Apache License
@Nullable public Text evaluate(@Nullable Text bloom1Str, @Nullable Text bloom2Str) throws HiveException { if (bloom1Str == null || bloom2Str == null) { return null; }/* w ww .jav 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.and(bloom2); try { return BloomFilterUtils.serialize(bloom1, new Text()); } catch (IOException e) { throw new HiveException(e); } }