[
https://issues.apache.org/jira/browse/AVRO-1363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ramana Suvarapu updated AVRO-1363:
----------------------------------
Attachment: reader.avpr
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira