You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/12/03 20:14:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16707733#comment-16707733 ]
ASF subversion and git services commented on AVRO-1363:
-------------------------------------------------------
Commit b5bec5ca18901507f6fc01d635f10465fd3edcdf in avro's branch refs/heads/master from Simon24601
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=b5bec5c ]
Avro1363 C# union schema can now contain multiple entries with the same name and different namespace (#131)
* AVRO-1849 Fix the issue where converting the schema of a record with no fields produced an invalid JSON
* Fix style issues in the code.
* Fix the build scripts; build.sh requires the :z addition to work on SELinux (see Jira 1925). lang/c++/build.sh refers to the lang/c++/build directory which is empty. These are now fixed.
* Update to use BOOST_TEST_CHECKPOINT
* AVRO-1926 Revert changes to the lang/c++/build.sh script and add the SchemaTests to the list of tests. Also revert SELinux changes to build.sh as these should be committed separately
* AVRO-1363 Fix the parsing of a union schema with duplicate names but different namespaces. In Java, this works, but not in C#
* Remove c++ changes from the AVRO1363 branch
> 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
> Priority: Major
> 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)