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

ASF GitHub Bot commented on AVRO-2058:
--------------------------------------

Weait commented on issue #237: [AVRO-2058] ReflectData#isNonStringMap returns 
true for Utf8 keys
URL: https://github.com/apache/avro/pull/237#issuecomment-400614936
 
 
   @samschlegel, what's the state of updating the PR with @nandorKollar's 
comments? Need someone to take over this pull request or can you finish within 
a reasonable amount of time?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> ReflectData#isNonStringMap returns true for Utf8 keys
> -----------------------------------------------------
>
>                 Key: AVRO-2058
>                 URL: https://issues.apache.org/jira/browse/AVRO-2058
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.2
>            Reporter: Sam Schlegel
>            Assignee: Sam Schlegel
>            Priority: Critical
>         Attachments: AVRO-2058.patch
>
>
> Since {{Utf8}} does not have an {{Stringable}} notation, and is not in 
> {{SpecificData#stringableClasses}}, {{ReflectData#isNonStringMap}} returns 
> true. This also causes {{ReflectData#isArray}} to return true for maps with 
> Utf8 keys, and thus {{GenericData#resolveUnion}} fails as well. This 
> ultimately causes {{ReflectData#write}} to fail for schemas that contain a 
> union that contains a map, where the data uses Utf8 for strings.
> This following test case reproduces the issue:
> {code:java}
>   @Test public void testUnionWithMapWithUtf8Keys() {
>     Schema s = new Schema.Parser().parse
>       ("[\"null\", {\"type\":\"map\",\"values\":\"float\"}]");
>     GenericData data = ReflectData.get();
>     HashMap<Utf8,Float> map = new HashMap<Utf8,Float>();
>     map.put(new Utf8("foo"), 1.0f);
>     assertEquals(1, data.resolveUnion(s, map));
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to