You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2020/03/16 07:01:20 UTC

[arrow] branch master updated: ARROW-8128: [C#] NestedType children serialized on wrong length

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new ab21f0e  ARROW-8128: [C#] NestedType children serialized on wrong length
ab21f0e is described below

commit ab21f0ee429c2a2c82e4dbc5d216ab1da74221a2
Author: Takashi Hashida <t-...@amiya.co.jp>
AuthorDate: Mon Mar 16 16:00:57 2020 +0900

    ARROW-8128: [C#] NestedType children serialized on wrong length
    
    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-...@amiya.co.jp>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs | 2 +-
 csharp/test/Apache.Arrow.Tests/TestData.cs               | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs b/csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs
index e41c194..4c2757a 100644
--- a/csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs
+++ b/csharp/src/Apache.Arrow/Ipc/ArrowReaderImplementation.cs
@@ -216,8 +216,8 @@ namespace Apache.Arrow.Ipc
             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()
diff --git a/csharp/test/Apache.Arrow.Tests/TestData.cs b/csharp/test/Apache.Arrow.Tests/TestData.cs
index 68709e8..db68f74 100644
--- a/csharp/test/Apache.Arrow.Tests/TestData.cs
+++ b/csharp/test/Apache.Arrow.Tests/TestData.cs
@@ -187,13 +187,15 @@ namespace Apache.Arrow.Tests
                 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();