Source:
public static final byte[] toBytes(final InputRow row, AggregatorFactory[] aggs, boolean reportParseExceptions) { try { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeLong(row.getTimestampFromEpoch()); List<String> dimList = row.getDimensions(); WritableUtils.writeVInt(out, dimList.size()); if (dimList != null) { for (String dim : dimList) { List<String> dimValues = row.getDimension(dim); writeString(dim, out); writeStringArray(dimValues, out); } } Supplier<InputRow> supplier = new Supplier<InputRow>() { @Override public InputRow get() { return row; } }; WritableUtils.writeVInt(out, aggs.length); for (AggregatorFactory aggFactory : aggs) { String k = aggFactory.getName(); writeString(k, out); try (Aggregator agg = aggFactory.factorize( IncrementalIndex.makeColumnSelectorFactory( VirtualColumns.EMPTY, aggFactory, supplier, true ) )) { try { agg.aggregate(); } catch (ParseException e) { if (reportParseExceptions) { throw new ParseException(e, "Encountered parse error for aggregator[%s]", k); } log.debug(e, "Encountered parse error, skipping aggregator[%s].", k); } String t = aggFactory.getTypeName(); if (agg.isNull()) { out.writeByte((byte) 1); } else { out.writeByte((byte) 0); if (t.equals("float")) { out.writeFloat(agg.getFloat()); } else if (t.equals("long")) { WritableUtils.writeVLong(out, agg.getLong()); } else if (t.equals("double")) { out.writeDouble(agg.getDouble()); } else { Object val = agg.get(); ComplexMetricSerde serde = getComplexMetricSerde(t); writeBytes(serde.toBytes(val), out); } } } } return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException(ex); } }

Target:
public static final byte[] toBytes(final InputRow row, AggregatorFactory[] aggs, boolean reportParseExceptions) { try { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeLong(row.getTimestampFromEpoch()); List<String> dimList = row.getDimensions(); WritableUtils.writeVInt(out, dimList.size()); if (dimList != null) { for (String dim : dimList) { List<String> dimValues = row.getDimension(dim); writeString(dim, out); writeStringArray(dimValues, out); } } Supplier<InputRow> supplier = new Supplier<InputRow>() { @Override public InputRow get() { return row; } }; WritableUtils.writeVInt(out, aggs.length); for (AggregatorFactory aggFactory : aggs) { String k = aggFactory.getName(); writeString(k, out); try (Aggregator agg = aggFactory.factorize( IncrementalIndex.makeColumnSelectorFactory( VirtualColumns.EMPTY, aggFactory, supplier, true ) )) { try { agg.aggregate(); } catch (ParseException e) { if (reportParseExceptions) { throw new ParseException(e, "Encountered parse error for aggregator[%s]", k); } log.debug(e, "Encountered parse error, skipping aggregator[%s].", k); } String t = aggFactory.getTypeName(); if (agg.isNull()) { out.writeByte(NULL_BYTE); } else { out.writeByte(NON_NULL_BYTE); if (t.equals("float")) { out.writeFloat(agg.getFloat()); } else if (t.equals("long")) { WritableUtils.writeVLong(out, agg.getLong()); } else if (t.equals("double")) { out.writeDouble(agg.getDouble()); } else { Object val = agg.get(); ComplexMetricSerde serde = getComplexMetricSerde(t); writeBytes(serde.toBytes(val), out); } } } } return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException(ex); } }