FunctionIdent fi = new FunctionIdent("collect_set", ImmutableList.<DataType>of(DataTypes.LONG));
AggregationFunction impl = (AggregationFunction) functions.get(fi);
AggregationState state = impl.newState();
BytesStreamOutput streamOutput = new BytesStreamOutput();
state.writeTo(streamOutput);
AggregationState newState = impl.newState();
newState.readFrom(new BytesStreamInput(streamOutput.bytes()));
assertEquals(state.value(), newState.value());
}