{
StateCompiler compiler = new StateCompiler();
AccumulatorStateFactory<NullableBigintState> factory = compiler.generateStateFactory(NullableBigintState.class);
AccumulatorStateSerializer<NullableBigintState> serializer = compiler.generateStateSerializer(NullableBigintState.class);
NullableBigintState state = factory.createSingleState();
NullableBigintState deserializedState = factory.createSingleState();
state.setLong(2);
state.setNull(false);
BlockBuilder builder = BigintType.BIGINT.createBlockBuilder(new BlockBuilderStatus());
serializer.serialize(state, builder);
state.setNull(true);
serializer.serialize(state, builder);
Block block = builder.build();
assertEquals(BIGINT.getLong(block, 0), state.getLong());
serializer.deserialize(block, 0, deserializedState);
assertEquals(deserializedState.getLong(), state.getLong());
assertEquals(block.isNull(1), state.isNull());
serializer.deserialize(block, 1, deserializedState);
assertEquals(deserializedState.isNull(), state.isNull());
}