You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2018/12/05 16:53:00 UTC
[jira] [Resolved] (AVRO-1363) C# UnionSchema fails to parse the the
unions with same type names with different namespaces
[ https://issues.apache.org/jira/browse/AVRO-1363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved AVRO-1363.
-------------------------------
Resolution: Fixed
Assignee: Daniel Kulp
Fix Version/s: 1.9.0
> 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: Apache Avro
> Issue Type: Bug
> Components: csharp
> Affects Versions: 1.7.4
> Reporter: Ramana Suvarapu
> Assignee: Daniel Kulp
> Priority: Major
> Fix For: 1.9.0
>
> 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
(v7.6.3#76005)