@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial == null) { return; } BytesWritable bytes = (BytesWritable) partial; ByteArrayInputStream in = new ByteArrayInputStream(bytes.getBytes()); // Deserialze the bloomfilter try { BloomFilter bf = BloomFilter.deserialize(in); ((BloomFilterBuf)agg).bloomFilter.merge(bf); } catch (IOException e) { throw new HiveException(e); } }
private void initValue() { try { Object val = bloomFilterDynamicValue.getValue(); if (val != null) { BinaryObjectInspector boi = (BinaryObjectInspector) bloomFilterDynamicValue.getObjectInspector(); byte[] bytes = boi.getPrimitiveJavaObject(val); bloomFilter = BloomFilter.deserialize(new ByteArrayInputStream(bytes)); } else { bloomFilter = null; } initialized = true; } catch (Exception err) { throw new RuntimeException(err); } }
byte[] bytes = new byte[bw.getLength()]; System.arraycopy(bw.getBytes(), 0, bytes, 0, bw.getLength()); bloomFilter = BloomFilter.deserialize(new ByteArrayInputStream(bytes)); } catch ( IOException e) { throw new HiveException(e);