[
https://issues.apache.org/jira/browse/AVRO-2058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16715500#comment-16715500
]
ASF subversion and git services commented on AVRO-2058:
-------------------------------------------------------
Commit 269d0ff7d3025cf3370023e353a373916dd67433 in avro's branch
refs/heads/master from [~dkulp]
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=269d0ff ]
[AVRO-2058] Fix issues with Utf8 keys maps being treated as non-strings
This closes #237
commit 8852da40e7a0ee58d9b027173a4972e7e71b432d
Author: Sam Schlegel <[email protected]>
Date: Wed Jul 26 19:20:51 2017 -0700
Add failing test
> ReflectData#isNonStringMap returns true for Utf8 keys
> -----------------------------------------------------
>
> Key: AVRO-2058
> URL: https://issues.apache.org/jira/browse/AVRO-2058
> Project: Apache 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)