Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6.3
-
None
-
None
Description
When the GenericDatumReader tries to create a resolver with the reader schema which contains a union where the default value is incompatible with the first field. It throws an error. As the resolvers are cached, when the resolver is not created, it is not pushed in the cache which results in an attempt to create a resolver whenever it tries to read a message. A possible fix is to not have a lazy initialization of the resolver but to have it at time of the creation of GenericDatumReader and handle the error at start. This ensures that the datumReader fails fast and will not try to create the resolver everytime it tries to read a message. An example of the reader schema
String readerSchemaDescription = " { \n"
+ " \"name\": \"User\", \n"
+ " \"type\": \"record\",\n" + " \"fields\": [\n"
+ "
,\n"
+ "
,\n"
+ "
]\n" + "}";