avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Damiaan van der Kruk (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1571) Support parameterized types in Avro
Date Fri, 27 Nov 2015 14:19:11 GMT

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

Damiaan van der Kruk commented on AVRO-1571:
--------------------------------------------

Got the same problem as [~rajiv.a1] but then with generating a protocol schema from a interface
with parameterized types. For example generating a protocol schema from:

public interface GenericType<T extends Number> {
        T m(T x);
}

Results in:

org.apache.avro.AvroTypeException: Error getting schema for T: Unknown type: T
	at org.apache.avro.reflect.ReflectData.getSchema(ReflectData.java:682)
	at org.apache.avro.reflect.ReflectData.getMessage(ReflectData.java:640)
	at org.apache.avro.reflect.ReflectData.getProtocol(ReflectData.java:619)

When will this be fixed and/or is their any workaround for this for now?

> Support parameterized types in Avro
> -----------------------------------
>
>                 Key: AVRO-1571
>                 URL: https://issues.apache.org/jira/browse/AVRO-1571
>             Project: Avro
>          Issue Type: Bug
>    Affects Versions: 1.7.6
>            Reporter: Sachin Goyal
>
> The below code cannot be serialized by Avro.
> {code}
> class ParameterTypes {
>   Master1 m1;
>   Master2 m2;
>   Master3<Integer> m3;
> }
> class Foo <P, Q> {
>   P p;
>   Q q;
> }
> class Master1 {
>   Foo <Integer, Long> foo;
> }
> class Master2 {
>   Foo <String, String> foo;
> }
> class Master3 <P> {
>   Foo <P, P> foo;
> }
> {code}
> This is because when generating the schema, only the current class is used to generate
the schema. The parent class' context is missing in ReflectData#createSchema() functions where
the actual type-information is present.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message