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

Kalle Niemitalo commented on AVRO-1556:
---------------------------------------

The parsing of logical types has changed after Avro 1.7.7, on which this issue 
was filed. In Avro 1.10.0, AVRO-2359 commit 
75e8f58c95e2b8c69af1a6f60c35a848a6781f0c added a LogicalSchema class, which 
outputs the "logicalType" property to JSON, so the output won't be just 
{{"type" : "string"}} as described in this issue. (However, see AVRO-2825 
regarding unrecognized logical types like "DateTimeInstant", and AVRO-3570 
regarding the JSON structure of logical types in general.) So, I'm not sure 
this issue can even be reproduced with the latest Avro 1.11.0 or the upcoming 
Avro 1.12.0.

[^AVRO-1556-csharp-primitiveschema-fix.patch] does not not apply to these 
versions, either. Here's an attempt on the release-1.11.0 tag:
{noformat}
$ patch -p0 < AVRO-1556-csharp-primitiveschema-fix.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file lang/csharp/src/apache/main/Schema/PrimitiveSchema.cs
Hunk #1 succeeded at 82 (offset 7 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file lang/csharp/src/apache/main/Schema/Schema.cs
Hunk #1 FAILED at 193.
Hunk #2 FAILED at 201.
2 out of 2 hunks FAILED -- saving rejects to file 
lang/csharp/src/apache/main/Schema/Schema.cs.rej
(Stripping trailing CRs from patch; use --binary to disable.)
patching file lang/csharp/src/apache/test/Schema/SchemaTests.cs
Hunk #1 succeeded at 137 (offset 10 lines).
{noformat}

> csharp PrimitiveSchema loses custom properties in WriteJson/ToString
> --------------------------------------------------------------------
>
>                 Key: AVRO-1556
>                 URL: https://issues.apache.org/jira/browse/AVRO-1556
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: csharp
>    Affects Versions: 1.7.7
>            Reporter: Dmitry Kovalev
>            Assignee: Dmitry Kovalev
>            Priority: Major
>             Fix For: 1.9.0
>
>         Attachments: AVRO-1556-csharp-primitiveschema-fix.patch
>
>
> PrimitiveSchema class overrides WriteJson method to handle a shotrcut where 
> primitive type is given as a literal, but in doing so it ignores teh case 
> where there are custom properties attached to it. 
> This breaks any functionality which relies on the equality of the schema 
> re-parsed from its ToString/WriteJson output, one example being csharp 
> codegen.
> Example:
> { "type": "string", "logicalType":"DateTimeInstant", 
> "logicalEncoding":"ISO8601-datetime-offset" }
> becomes "type" : "string"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to