You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Andy Le (Jira)" <ji...@apache.org> on 2020/04/19 08:55:00 UTC

[jira] [Commented] (AVRO-2805) Reflection-based schema not loading types

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

Andy Le commented on AVRO-2805:
-------------------------------

[~pcless] Your example code contain errors. I decided to wrap your logic inside a test


{code:java}
  public static class Definition {
    public Map<String, Type> tokens;
  }

  public enum Type {
    A,
    B,
    C
  }

  @Test
  public void testAvro2805() {
    Schema schema = ReflectData.get().getSchema(Definition.class);

    final String schemaString = schema.toString(true);

    System.out.println(schemaString);
  }
{code}

I can NOT see your exception above. I've got this one instead:


{noformat}
org.apache.avro.SchemaParseException: Illegal character in: this$0

	at org.apache.avro.Schema.validateName(Schema.java:1530)
	at org.apache.avro.Schema.access$400(Schema.java:87)
	at org.apache.avro.Schema$Field.<init>(Schema.java:518)
	at org.apache.avro.Schema$Field.<init>(Schema.java:557)
	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:683)

{noformat}

Please kindly verify your issue again and let me know.




> Reflection-based schema not loading types 
> ------------------------------------------
>
>                 Key: AVRO-2805
>                 URL: https://issues.apache.org/jira/browse/AVRO-2805
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.9.1
>            Reporter: Pedro Cardoso Silva
>            Priority: Critical
>
> Avro reflection is unable to generate a schema for the following definition:
> {code:java} 
> public class Definition {
>     pubilc Map<String, Type>
> }
> public enum Type {
>   A,
>   B,
>   C
> }
> {code}
> {code:java}
> // Test code
> Schema schema = ReflectData.get().getSchema(Definition.class)
> {code}
> Fails with: 
> Undefined name: "FieldType"
> org.apache.avro.SchemaParseException: Undefined name: "Type"



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