private void _serialise(final HyperLogLogPlus hyperLogLogPlus, final JsonGenerator jsonGenerator)
     throws IOException {
   jsonGenerator.writeObjectFieldStart("hyperLogLogPlus");
   jsonGenerator.writeObjectField(
       HyperLogLogPlusJsonConstants.HYPER_LOG_LOG_PLUS_SKETCH_BYTES_FIELD,
       hyperLogLogPlus.getBytes());
   jsonGenerator.writeNumberField(
       HyperLogLogPlusJsonConstants.CARDINALITY_FIELD, hyperLogLogPlus.cardinality());
   jsonGenerator.writeEndObject();
 }
 protected static HyperLogLogPlus countDisctinct(Tuple input, int p)
     throws NumberFormatException, IOException {
   HyperLogLogPlus estimator = new HyperLogLogPlus(p);
   DataBag values = (DataBag) input.get(0);
   for (Iterator<Tuple> it = values.iterator(); it.hasNext(); ) {
     Tuple t = it.next();
     Object data = t.get(0);
     if (data instanceof Long) {
       estimator.offerHashed((Long) data);
     } else if (data instanceof DataByteArray) {
       DataByteArray bytes = (DataByteArray) data;
       HyperLogLogPlus newEstimator;
       try {
         newEstimator = HyperLogLogPlus.Builder.build(bytes.get());
         estimator = (HyperLogLogPlus) estimator.merge(newEstimator);
       } catch (IOException e) {
         throw new RuntimeException(e);
       } catch (CardinalityMergeException e) {
         throw new RuntimeException(e);
       }
     }
   }
   return estimator;
 }