[
https://issues.apache.org/jira/browse/AVRO-1363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15658499#comment-15658499
]
ASF GitHub Bot commented on AVRO-1363:
--------------------------------------
GitHub user Simon24601 opened a pull request:
https://github.com/apache/avro/pull/156
AVRO-1363 Fix the C# parsing of a union schema
Fix the C# parsing of a union schema that contains duplicate names but in
different namespaces. The full name is now used when parsing the schema. This
is identical to my previous pull request on this topic, but I've rebased to
apache/master and squashed all the commits to a single commit.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Simon24601/avro AVRO_1363_squashed
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/avro/pull/156.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #156
----
commit d7b6622343590ce7304a03a7e2085dde34f5f2ab
Author: srw <srw@localhost>
Date: 2016-11-11T23:23:11Z
AVRO-1363 Fix the C# parsing of a union schema that contains duplicate
names but in different namespaces. The full name is now used when parsing the
schema
----
> C# UnionSchema fails to parse the the unions with same type names with
> different namespaces
> -------------------------------------------------------------------------------------------
>
> Key: AVRO-1363
> URL: https://issues.apache.org/jira/browse/AVRO-1363
> Project: Avro
> Issue Type: Bug
> Components: csharp
> Affects Versions: 1.7.4
> Reporter: Ramana Suvarapu
> Attachments: reader.avpr
>
>
> C# Union schema is unable to handle same type names with different
> namespaces. It's throwing "SchemaParseException("Duplicate type in union:
> "...) exception.
> In the below code, key of uniqueSchemas should be FullName of the type which
> is similar to Java implementation.
> internal static UnionSchema NewInstance(JArray jarr, PropertyMap props,
> SchemaNames names, string encspace)
> {
> List<Schema> schemas = new List<Schema>();
> IDictionary<string, string> uniqueSchemas = new
> Dictionary<string, string>();
> foreach (JToken jvalue in jarr)
> {
> Schema unionType = Schema.ParseJson(jvalue, names, encspace);
> if (null == unionType)
> throw new SchemaParseException("Invalid JSON in union" +
> jvalue.ToString());
> string name = unionType.Name;
> if (uniqueSchemas.ContainsKey(name))
> throw new SchemaParseException("Duplicate type in union:
> " + name);
> uniqueSchemas.Add(name, name);
> schemas.Add(unionType);
> }
> return new UnionSchema(schemas, props);
> }
> See the attachement to recreate the issue
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)