[ 
https://issues.apache.org/jira/browse/FLINK-18223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dawid Wysakowicz closed FLINK-18223.
------------------------------------
    Fix Version/s: 1.10.2
                   1.11.0
       Resolution: Fixed

Fixed in:
* master
** f1e421197195c63bb570be76125de4db72dbefbf
* 1.11.0
** b1834221961162c37b14e3185c1249535fbd32ec
* 1.10.2
** 2a381c926c649c9f282ee02331996ce6499a2b60

> AvroSerializer does not correctly instantiate GenericRecord
> -----------------------------------------------------------
>
>                 Key: FLINK-18223
>                 URL: https://issues.apache.org/jira/browse/FLINK-18223
>             Project: Flink
>          Issue Type: Bug
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>    Affects Versions: 1.10.1
>            Reporter: Lorenzo Nicora
>            Assignee: Lorenzo Nicora
>            Priority: Major
>              Labels: AVRO, pull-request-available
>             Fix For: 1.11.0, 1.10.2
>
>
> {{AvroSerializer.createInstance()}} simply calls 
> {{InstantiationUtil.instantiate(type)}} to create a new instance, also when 
> type is GenericRecord.
> This fails with an exception, because a GenericRecord must be instantiated 
> through {{GenericRecordBuilder}} but {{InstantiationUtil}} is not aware of it.
> {code:java}
> The class 'org.apache.avro.generic.GenericRecord' is not instantiable: The 
> class is not a proper class. It is either abstract, an interface, or a 
> primitive type.{code}
> This can be proven with this test
> {code:java}
> @Test
> public void shouldInstantiateGenericRecord() {
>     org.apache.avro.Schema SCHEMA = new 
> org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Dummy\",\"namespace\":\"dummy\",\"fields\":[{\"name\":\"something\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}");
>     AvroSerializer<GenericRecord> serializer = new 
> AvroSerializer<>(GenericRecord.class, SCHEMA);
>     serializer.createInstance();
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to