You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/13 17:37:01 UTC

[GitHub] [arrow] HashidaTKS commented on a change in pull request #11931: ARROW-15071: [C#] Fixed a bug in Column.cs ValidateArrayDataTypes method

HashidaTKS commented on a change in pull request #11931:
URL: https://github.com/apache/arrow/pull/11931#discussion_r767949700



##########
File path: csharp/src/Apache.Arrow/Column.cs
##########
@@ -62,7 +62,7 @@ private bool ValidateArrayDataTypes()
         {
             for (int i = 0; i < Data.ArrayCount; i++)
             {
-                if (Data.Array(i).Data.DataType != Field.DataType)
+                if (Data.Array(i).Data.DataType.TypeId != Field.DataType.TypeId)

Review comment:
       Don't we need also compare other members?
   
   * `Children` when it is `NestedType`
   * `ByteWidth` when it is `FixedSizeBinaryType`
   
   I suppose we need to create a new `ArrowType` comparer for the product projects like `ArrayTypeComparer` of `Apache.Arrow.Tests` and use it.
   https://github.com/apache/arrow/blob/master/csharp/test/Apache.Arrow.Tests/ArrayTypeComparer.cs

##########
File path: csharp/test/Apache.Arrow.Tests/ArrowFileReaderTests.cs
##########
@@ -155,5 +157,19 @@ public async Task TestReadMultipleRecordBatchAsync()
                 ArrowReaderVerifier.CompareBatches(originalBatch1, readBatch3);
             }
         }
+
+        [Fact]
+        public void TestRecordBatchBasics()
+        {
+            RecordBatch recordBatch = TestData.CreateSampleRecordBatch(length: 1);
+            Assert.Throws<ArgumentOutOfRangeException>(() => new RecordBatch(recordBatch.Schema, recordBatch.Arrays, -1));
+
+            var col1 = recordBatch.Column(0);
+            var col2 = recordBatch.Column("list0");
+            ArrowReaderVerifier.CompareArrays(col1, col2);
+
+            recordBatch.Dispose();

Review comment:
       Do we need this `Dispose()`?
   How about using `using` statement and delete this line if we need to dispose?
   
   ```
   using RecordBatch recordBatch = TestData.CreateSampleRecordBatch(length: 1);
   ```

##########
File path: csharp/test/Apache.Arrow.Tests/TableTests.cs
##########
@@ -49,6 +49,13 @@ public void TestTableBasics()
             Table table = MakeTableWithOneColumnOfTwoIntArrays(10);
             Assert.Equal(20, table.RowCount);
             Assert.Equal(1, table.ColumnCount);
+
+            RecordBatch recordBatch = TestData.CreateSampleRecordBatch(length: 1);

Review comment:
       How about creating a new test method for this case?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org