9. A computer system for generating at least one of a serializer and a deserializer for compiling a query, the computer system comprising: one or more computer processors; one or more computer readable storage media; and program instructions stored on the computer readable storage media for execution by at least one of the one or more processors, the program instructions comprising: program instructions to infer a type of serialization for each generation site of compiling a query; program instructions to execute the inferred type of serialization, while transcribing identification information assigned to each generation site to a type as an annotation; program instructions to specialize a serializer for each generation site, based on the inferred type of serialization and a type of serialization that is actually used at a generation site; program instructions to recursively compare the inferred type of serialization and the type of serialization that is actually used at a generation site; and program instructions to serialize a data value using the specialized serializer for each generation site.
11. The computer system of claim 9 , wherein in a case of generating a serializer of a selection type in which a first type is selected from a plurality of types, the program instructions to specialize a serializer for each generation site, further comprise program instructions to: in response to determining that a second type is a subtype of only the selected first type, generating code for outputting a numeric value; and generating code for serializing a data value, based on the second type and the selected first type.