Fixed avro schema decode error in functions (#6662)
Fixes #5503
From #6445
# Motivation
In functions, it will encounter ```ClassCastException``` when using the Avro schema for topics.
```
Exception in thread "main" java.lang.ClassCastException: org.apache.pulsar.shade.org.apache.avro.generic.GenericData$Record cannot be cast to io.streamnative.KeyValueSchemaTest$Foo2
at io.streamnative.KeyValueSchemaTest.testConsumerByPythonProduce(KeyValueSchemaTest.java:412)
at io.streamnative.KeyValueSchemaTest.main(KeyValueSchemaTest.java:305)
```
# Modifications
In functions, when using Avro schema specific the ClassLoader for ReflectDatumReader.
Add integration test ```testAvroSchemaFunction``` in class ```PulsarFunctionsTest```.
2 files changed