avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elliot West <tea...@gmail.com>
Subject Re: Decode Avro map with java
Date Sat, 04 Mar 2017 19:13:14 GMT
I think what you're seeing is the value type only, which may contain null
and is thus represented as an Avro union of null and string. The key type
of an Avro may is assumed to be string according to the specification.

On Sat, 4 Mar 2017 at 13:37, Telco Phone <telco5@yahoo.com> wrote:

> I am trying to get to the key AND value data type for a java Map.
>
> Given the orginal java converted to avro
>
> private java.util.Map<java.lang.String,java.lang.String> testmap;
>
>
> I am using the following in Java to decode.
>
>    // Print out the schema
>    System.err.println("Map class type " +f.schema().toString());
>
>    // Print out datatype for key / value
>    for (Schema st : f.schema().getValueType().getTypes())
>            System.err.println("ST is " + st.getName());
>
> With a result of:
>
> Map class type
> {"type":"map","values":["null",{"type":"string","avro.java.string":"String"}],"avro.java.string":"String","default":null}
> ST is null
> ST is string
>
>
> Should I not get both the orginal <string,string> ?? (From the above
> testmap)
>
>
> Thanks in advance....
>

Mime
View raw message