[ 
https://issues.apache.org/jira/browse/AVRO-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769136#comment-17769136
 ] 

Oscar Westra van Holthe - Kind commented on AVRO-3848:
------------------------------------------------------

"Is there a way to use the class specific decoder in a more generic way (at 
runtime I do not know which class is being decoded)?"

Yes: all SpecificRecord implementations (at least if created using the default 
template) have static methods {{getClassSchema()}}, {{getDecoder()}}, and 
{{getEncoder()}}

Instances of {{SpecificRecord}} (the default template also creates a default 
constructor, even if that object will fail to serialise) also implement a 
method {{getSchema()}} that returns the same schema.

In either case, you'll need reflection as [[email protected]] indicated.

> MessageDeserializer uses wrong type for map fields
> --------------------------------------------------
>
>                 Key: AVRO-3848
>                 URL: https://issues.apache.org/jira/browse/AVRO-3848
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Eduard Schleining
>            Priority: Major
>
> When using the avro-maven-plugin to generate classes with map fields, the 
> MessageDecoder will disregard the "stringType" setting and always provide a 
> map with entries of type UTF8 instead of String.
> You can see the behavior in the unit test here:
> [https://github.com/eschleining/avroMapDeserialization]
> Expected Behavior:
> The org.apache.avro.message.MessageDecoder should use keys and values of type 
> String for classes with fields of type Map<String,String>.
> Actual Behavior:
> The org.apache.avro.message.MessageDecoder puts Map<Utf8,Utf8> into fields 
> that are generated as Map<String,String>



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to