Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.12.0
-
None
Description
The current implementation of LogicalType Conversions in GenericData.resolveUnion(schema, datum) fails with AvroRuntimeException when the datum used is any instance of the type used by the converter. This is due to Class<?> being used as the key of map in GenericData.conversionsByClass, where as a better implementation would be to iterate over the applicable logical type converters, for each schema in the union and test if conversion.getConvertedType().isInstance(datum)
Practical examples of logical type subclassing we are using:
- "ip-address" logical type string converter to/from java.net.InetAddress (with Inet4Address, Inet6Address as subclasses)
- "json" logical type string conversion to/from Jackson's JsonNode (with ObjectNode, ArrayNode, etc as subclasses)
Attachments
Issue Links
- links to