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

Bruce Bukovics commented on AVRO-1363:
--------------------------------------

I've run into this same issue recently and locally hacked the avro code to 
correct the issue in a similar way.  Is there any ETA on when this fix might 
make it into the product?

> 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.4.14#64029)

Reply via email to