Antti Ahonen
04/24/2024, 11:21 AMstatic <T> AvroFactory<T> create(Class<T> type, @Nullable Schema currentSchema, @Nullable Schema previousSchema) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (SpecificRecord.class.isAssignableFrom(type)) {
return fromSpecific(type, cl, Optional.ofNullable(previousSchema));
} else {
return GenericRecord.class.isAssignableFrom(type) ? fromGeneric(cl, currentSchema) : fromReflective(type, cl, Optional.ofNullable(previousSchema));
}
}
Because my own POJO implements interface org.apache.avro.specific.SpecificRecord that is loaded from that blobStorage file, and the check SpecificRecord.class.isAssignableFrom(type) has the original SpecificRecord from the supplied job jar, it doesn't know how to treat my avro record as a specific record, instead it tried to reflective get the schema, which goes wrong.
Any idea how to resolve this issue?Antti Ahonen
04/24/2024, 11:45 AM