You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/04/11 11:00:00 UTC
[jira] [Commented] (AVRO-3724) C# JsonEncoder can't handle nested array of records
[ https://issues.apache.org/jira/browse/AVRO-3724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17710882#comment-17710882 ]
ASF subversion and git services commented on AVRO-3724:
-------------------------------------------------------
Commit 9b5688863f0b692e6c73a3af808ae1836065f0fe in avro's branch refs/heads/avro-3653-arm64-on-github-actions from Robert Yokota
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=9b5688863 ]
AVRO-3724 Fix C# JsonEncoder for nested array of records (#2161)
* AVRO-3724 Fix C# JsonEncoder for nested array of records
* Fix warning by with using clause
> C# JsonEncoder can't handle nested array of records
> ---------------------------------------------------
>
> Key: AVRO-3724
> URL: https://issues.apache.org/jira/browse/AVRO-3724
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp
> Affects Versions: 1.11.2
> Reporter: Andrew Benedek
> Assignee: Robert Yokota
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.12.0, 1.11.2
>
> Attachments: PAYMENT.cs, Program.cs, Transaction.cs, sample2.avsc
>
> Time Spent: 2h
> Remaining Estimate: 0h
>
> The exception is:
> Avro.AvroTypeException
> HResult=0x80131500
> Message=Incorrect number of items written. 1 more required.
> Source=Avro
> StackTrace:
> at Avro.IO.ParsingEncoder.Pop() in C:\code\avro\lang\csharp\src\apache\main\IO\ParsingEncoder.cs:line 135
> at Avro.IO.JsonEncoder.WriteArrayEnd() in C:\code\avro\lang\csharp\src\apache\main\IO\JsonEncoder.cs:line 259
> at Avro.Generic.PreresolvingDatumWriter`1.WriteArray(WriteItem itemWriter, Object array, Encoder encoder) in C:\code\avro\lang\csharp\src\apache\main\Generic\PreresolvingDatumWriter.cs:line 235
> at Avro.Generic.PreresolvingDatumWriter`1.<>c_{_}DisplayClass20_0.<ResolveArray>b{_}_0(Object d, Encoder e) in C:\code\avro\lang\csharp\src\apache\main\Generic\PreresolvingDatumWriter.cs:line 225
> at Avro.Specific.SpecificDatumWriter`1.WriteRecordFields(Object recordObj, RecordFieldWriter[] writers, Encoder encoder) in C:\code\avro\lang\csharp\src\apache\main\Specific\SpecificDatumWriter.cs:line 46
> at Avro.Generic.PreresolvingDatumWriter`1.<>c_{_}DisplayClass14_0.<ResolveRecord>b{_}_0(Object v, Encoder e) in C:\code\avro\lang\csharp\src\apache\main\Generic\PreresolvingDatumWriter.cs:line 147
> at Avro.Generic.PreresolvingDatumWriter`1.Write(T datum, Encoder encoder) in C:\code\avro\lang\csharp\src\apache\main\Generic\PreresolvingDatumWriter.cs:line 52
> at Program.<Main>$(String[] args) in C:\code\ips-sales-replication\producer\AvroConsoleApp\Program.cs:line 210
>
> I have cloned the GitHub repo and built the C# solution (Avro.dll) since 1.11.2 with the JsonEncoder has not yet been released as a Nuget package.
> A schema with a nested record works fine.
> A schema with a nested array of record throws the above exception.
> The BinaryEncoder however is able to produce the binary Avro with the same schema.
> I have attached the schema.
> My code is a simple C# .NET console application.
> Program.cs is also attached along with the schema data model that was generated using CodeGen.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)