Skip to content

Commit

Permalink
ARROW-8128: [C#] NestedType children serialized on wrong length
Browse files Browse the repository at this point in the history
Move MoveNextMode to the correct line.

Background:

Each node of NestedType children is serialized on a previous node Length and NullCount.
This causes wrong data access at ListArray.GetValueOffset and so on.

Closes #6628 from HashidaTKS/ARROW-8128_fix_NestedType_serialization_bug

Authored-by: Takashi Hashida <t-hashida@amiya.co.jp>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
Takashi Hashida authored and kou committed Mar 16, 2020
1 parent d693e71 commit ab21f0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ internal static ByteBuffer CreateByteBuffer(ReadOnlyMemory<byte> buffer)
var children = new ArrayData[childrenCount];
for (var index = 0; index < childrenCount; index++)
{
Flatbuf.FieldNode childFieldNode = recordBatchEnumerator.CurrentNode;
recordBatchEnumerator.MoveNextNode();
Flatbuf.FieldNode childFieldNode = recordBatchEnumerator.CurrentNode;

var childField = type.Children[index];
var child = childField.DataType.IsFixedPrimitive()
Expand Down
4 changes: 3 additions & 1 deletion csharp/test/Apache.Arrow.Tests/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ public void Visit(ListType type)
var builder = new ListArray.Builder(type.ValueField).Reserve(Length);

//Todo : Support various types
var valueBuilder = (Int64Array.Builder)builder.ValueBuilder.Reserve(Length);
var valueBuilder = (Int64Array.Builder)builder.ValueBuilder.Reserve(Length + 1);

for (var i = 0; i < Length; i++)
{
builder.Append();
valueBuilder.Append(i);
}
//Add a value to check if Values.Length can exceed ListArray.Length
valueBuilder.Append(0);

Array = builder.Build();

Expand Down

0 comments on commit ab21f0e

Please sign in to comment.