[jira] [Commented] (AVRO-3568) C# ToParsingForm normalizes logical type to "logical" rather than base type
[ https://issues.apache.org/jira/browse/AVRO-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17597829#comment-17597829 ] ASF subversion and git services commented on AVRO-3568: --- Commit a60b748c1694dcf3fd2b617e75fcc9c1634fd150 in avro's branch refs/heads/branch-1.11 from Martin Tzvetanov Grigorov [ https://gitbox.apache.org/repos/asf?p=avro.git;h=a60b748c1 ] AVRO-3001 AVRO-3274 AVRO-3568 AVRO-3613: Add JSON encoder/decoder for C# Remove Encoder#Flush() method for backward compatibility Signed-off-by: Martin Tzvetanov Grigorov > C# ToParsingForm normalizes logical type to "logical" rather than base type > --- > > Key: AVRO-3568 > URL: https://issues.apache.org/jira/browse/AVRO-3568 > Project: Apache Avro > Issue Type: Bug > Components: csharp, logical types >Affects Versions: 1.11.0 >Reporter: Kalle Niemitalo >Assignee: Robert Yokota >Priority: Major > Labels: pull-request-available > Fix For: 1.12.0 > > > In the Avro C# library, if Avro.SchemaNormalization.ToParsingForm(Schema) is > given a schema that includes a logical type, then it normalizes that just to > "logical" and not to the base type. The resulting JSON cannot even be parsed > by Avro.Schema.Parse(string). This also makes > SchemaNormalization.ParsingFingerprint return an incorrect fingerprint for > schemas that include logical types. > h2. To reproduce > {code:C#} > using System; > class Program > { > static void Main() > { > var schema = Avro.Schema.Parse( > @"[""int"", {""type"": ""string"", ""logicalType"": ""uuid""}]"); > string pcf = Avro.SchemaNormalization.ToParsingForm(schema); > Console.WriteLine(pcf); > Avro.Schema.Parse(pcf); > } > } > {code} > h2. Expected result > {noformat} > ["int","string"] > {noformat} > h2. Actual result > {noformat} > ["int","logical"] > Unhandled exception. Avro.SchemaParseException: Undefined name: logical at > '[1]' >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.UnionSchema.NewInstance(JArray jarr, PropertyMap props, > SchemaNames names, String encspace) >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json) >at Program.Main() > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (AVRO-3568) C# ToParsingForm normalizes logical type to "logical" rather than base type
[ https://issues.apache.org/jira/browse/AVRO-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17597812#comment-17597812 ] ASF subversion and git services commented on AVRO-3568: --- Commit bc5d76e4785716814d258e7d38410782aede97a5 in avro's branch refs/heads/branch-1.11 from Robert Yokota [ https://gitbox.apache.org/repos/asf?p=avro.git;h=bc5d76e47 ] AVRO-3001 AVRO-3274 AVRO-3568 AVRO-3613: Add JSON encoder/decoder for C# (#1833) * AVRO-3001 AVRO-3274: Add JSON encoder/decoder for C# * Add more comments for public/protected members * Make CodeQL happy * Make CodeQL happy again * Minor optimization * Fix cosmetic issues * Fix JsonEncoder.StartItem accessibility * Minor doc fix * Add fixes and test for JSON encoding/decoding logical types * Fix fullname calculation for logical schemas * Fix for AVRO-3613 * Fix for AVRO-3568 * Add union with record test * Fix test * Incorporate review feedback * Incorporate review feedback * More cleanup * Revert previous cleanup in favor of recommended cleanup * Incorporate more review feedback * Incorporate latest review feedback * Add more unit tests * Simplify string constant * Simplify string constant * Simplify string constant * Simplify string constant Co-authored-by: Martin Grigorov (cherry picked from commit 1841ff115d52727094998b80798d52210b8addb6) > C# ToParsingForm normalizes logical type to "logical" rather than base type > --- > > Key: AVRO-3568 > URL: https://issues.apache.org/jira/browse/AVRO-3568 > Project: Apache Avro > Issue Type: Bug > Components: csharp, logical types >Affects Versions: 1.11.0 >Reporter: Kalle Niemitalo >Assignee: Robert Yokota >Priority: Major > Labels: pull-request-available > Fix For: 1.12.0 > > > In the Avro C# library, if Avro.SchemaNormalization.ToParsingForm(Schema) is > given a schema that includes a logical type, then it normalizes that just to > "logical" and not to the base type. The resulting JSON cannot even be parsed > by Avro.Schema.Parse(string). This also makes > SchemaNormalization.ParsingFingerprint return an incorrect fingerprint for > schemas that include logical types. > h2. To reproduce > {code:C#} > using System; > class Program > { > static void Main() > { > var schema = Avro.Schema.Parse( > @"[""int"", {""type"": ""string"", ""logicalType"": ""uuid""}]"); > string pcf = Avro.SchemaNormalization.ToParsingForm(schema); > Console.WriteLine(pcf); > Avro.Schema.Parse(pcf); > } > } > {code} > h2. Expected result > {noformat} > ["int","string"] > {noformat} > h2. Actual result > {noformat} > ["int","logical"] > Unhandled exception. Avro.SchemaParseException: Undefined name: logical at > '[1]' >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.UnionSchema.NewInstance(JArray jarr, PropertyMap props, > SchemaNames names, String encspace) >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json) >at Program.Main() > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (AVRO-3568) C# ToParsingForm normalizes logical type to "logical" rather than base type
[ https://issues.apache.org/jira/browse/AVRO-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17597808#comment-17597808 ] ASF subversion and git services commented on AVRO-3568: --- Commit 1841ff115d52727094998b80798d52210b8addb6 in avro's branch refs/heads/master from Robert Yokota [ https://gitbox.apache.org/repos/asf?p=avro.git;h=1841ff115 ] AVRO-3001 AVRO-3274 AVRO-3568 AVRO-3613: Add JSON encoder/decoder for C# (#1833) * AVRO-3001 AVRO-3274: Add JSON encoder/decoder for C# * Add more comments for public/protected members * Make CodeQL happy * Make CodeQL happy again * Minor optimization * Fix cosmetic issues * Fix JsonEncoder.StartItem accessibility * Minor doc fix * Add fixes and test for JSON encoding/decoding logical types * Fix fullname calculation for logical schemas * Fix for AVRO-3613 * Fix for AVRO-3568 * Add union with record test * Fix test * Incorporate review feedback * Incorporate review feedback * More cleanup * Revert previous cleanup in favor of recommended cleanup * Incorporate more review feedback * Incorporate latest review feedback * Add more unit tests * Simplify string constant * Simplify string constant * Simplify string constant * Simplify string constant Co-authored-by: Martin Grigorov > C# ToParsingForm normalizes logical type to "logical" rather than base type > --- > > Key: AVRO-3568 > URL: https://issues.apache.org/jira/browse/AVRO-3568 > Project: Apache Avro > Issue Type: Bug > Components: csharp, logical types >Affects Versions: 1.11.0 >Reporter: Kalle Niemitalo >Assignee: Robert Yokota >Priority: Major > Labels: pull-request-available > Fix For: 1.12.0 > > > In the Avro C# library, if Avro.SchemaNormalization.ToParsingForm(Schema) is > given a schema that includes a logical type, then it normalizes that just to > "logical" and not to the base type. The resulting JSON cannot even be parsed > by Avro.Schema.Parse(string). This also makes > SchemaNormalization.ParsingFingerprint return an incorrect fingerprint for > schemas that include logical types. > h2. To reproduce > {code:C#} > using System; > class Program > { > static void Main() > { > var schema = Avro.Schema.Parse( > @"[""int"", {""type"": ""string"", ""logicalType"": ""uuid""}]"); > string pcf = Avro.SchemaNormalization.ToParsingForm(schema); > Console.WriteLine(pcf); > Avro.Schema.Parse(pcf); > } > } > {code} > h2. Expected result > {noformat} > ["int","string"] > {noformat} > h2. Actual result > {noformat} > ["int","logical"] > Unhandled exception. Avro.SchemaParseException: Undefined name: logical at > '[1]' >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.UnionSchema.NewInstance(JArray jarr, PropertyMap props, > SchemaNames names, String encspace) >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json) >at Program.Main() > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (AVRO-3568) C# ToParsingForm normalizes logical type to "logical" rather than base type
[ https://issues.apache.org/jira/browse/AVRO-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17561857#comment-17561857 ] Kalle Niemitalo commented on AVRO-3568: --- The SchemaNormalization class was missed when support for logical types was added in AVRO-2359, [https://github.com/apache/avro/pull/492], [https://github.com/confluentinc/avro/pull/14]. In contrast, the Java library need not unwrap logical types in SchemaNormalization, because it has a {{LogicalType getLogicalType()}} method right in the Schema class, instead of defining a Schema.Type.LOGICAL constant and a LogicalSchema class. > C# ToParsingForm normalizes logical type to "logical" rather than base type > --- > > Key: AVRO-3568 > URL: https://issues.apache.org/jira/browse/AVRO-3568 > Project: Apache Avro > Issue Type: Bug > Components: csharp >Affects Versions: 1.11.0 >Reporter: Kalle Niemitalo >Priority: Major > Labels: logical > > In the Avro C# library, if Avro.SchemaNormalization.ToParsingForm(Schema) is > given a schema that includes a logical type, then it normalizes that just to > "logical" and not to the base type. The resulting JSON cannot even be parsed > by Avro.Schema.Parse(string). This also makes > SchemaNormalization.ParsingFingerprint return an incorrect fingerprint for > schemas that include logical types. > h2. To reproduce > {code:C#} > using System; > class Program > { > static void Main() > { > var schema = Avro.Schema.Parse( > @"[""int"", {""type"": ""string"", ""logicalType"": ""uuid""}]"); > string pcf = Avro.SchemaNormalization.ToParsingForm(schema); > Console.WriteLine(pcf); > Avro.Schema.Parse(pcf); > } > } > {code} > h2. Expected result > {noformat} > ["int","string"] > {noformat} > h2. Actual result > {noformat} > ["int","logical"] > Unhandled exception. Avro.SchemaParseException: Undefined name: logical at > '[1]' >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.UnionSchema.NewInstance(JArray jarr, PropertyMap props, > SchemaNames names, String encspace) >at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json, SchemaNames names, String encspace) >at Avro.Schema.Parse(String json) >at Program.Main() > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)