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

Amrit Sarkar commented on FLINK-18692:
--------------------------------------

{{AvroSerializationSchema}} resolves the schema via 
{{SpecificData.get().getSchema(clazz)}}, which needs a static {{SCHEMA$}} field 
that avrohugger classes don't have. {{AvroDeserializationSchema}} fails the 
same way on Avro 1.11, since {{SpecificDatumReader}} re-resolves the schema 
from the class when no expected schema is set. I have a fix that routes both 
through {{AvroFactory}}, with a test record without {{SCHEMA$}} covering both 
directions.

Would it be ok if I pick this up? Happy to be assigned.

> AvroSerializationSchema does not work with types generated by avrohugger
> ------------------------------------------------------------------------
>
>                 Key: FLINK-18692
>                 URL: https://issues.apache.org/jira/browse/FLINK-18692
>             Project: Flink
>          Issue Type: Bug
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>            Reporter: Aljoscha Krettek
>            Priority: Not a Priority
>              Labels: auto-deprioritized-major, auto-deprioritized-minor, 
> starter
>
> The main problem is that the code in {{SpecificData.createSchema()}} tries to 
> reflectively read the {{SCHEMA$}} field, that is normally there in Avro 
> generated classes. However, avrohugger generates this field in a companion 
> object, which the reflective Java code will therefore not find.
> This is also described in these ML threads:
>  * 
> [https://lists.apache.org/thread.html/5db58c7d15e4e9aaa515f935be3b342fe036e97d32e1fb0f0d1797ee@%3Cuser.flink.apache.org%3E]
>  * 
> [https://lists.apache.org/thread.html/cf1c5b8fa7f095739438807de9f2497e04ffe55237c5dea83355112d@%3Cuser.flink.apache.org%3E]



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

Reply via email to