Skip to content

Commit 41c6c0a

Browse files
adamreeverok
authored andcommitted
apacheGH-41198: [C#] Fix concatenation of union arrays (apache#41226)
### Rationale for this change Fixes concatenation of union arrays. ### What changes are included in this PR? * Re-enables union array concatenation tests that were disabled in apache#41197 after making union array comparisons more thorough in the `ArrowReaderVerifier` * Updates the union array concatenation logic to account for array lengths when concatenating the type and offset buffers, and fixes how the base offset is calculated. * Fixes creating the type buffers for the array concatenation tests. ### Are these changes tested? Yes, this uses the existing `ArrowArrayConcatenatorTests` tests. ### Are there any user-facing changes? Yes, this is a user-facing bug fix. * GitHub Issue: apache#41198 Authored-by: Adam Reeve <adreeve@gmail.com> Signed-off-by: Curt Hagenlocher <curt@hagenlocher.org>
1 parent 8b180d3 commit 41c6c0a

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

csharp/test/Apache.Arrow.Tests/ArrowArrayConcatenatorTests.cs

+1-11
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ public void TestStandardCases()
2929
{
3030
foreach ((List<IArrowArray> testTargetArrayList, IArrowArray expectedArray) in GenerateTestData())
3131
{
32-
if (expectedArray is UnionArray)
33-
{
34-
// Union array concatenation is incorrect. See https://github.com/apache/arrow/issues/41198
35-
continue;
36-
}
37-
3832
IArrowArray actualArray = ArrowArrayConcatenator.Concatenate(testTargetArrayList);
3933
ArrowReaderVerifier.CompareArrays(expectedArray, actualArray);
4034
}
@@ -410,15 +404,11 @@ public void Visit(UnionType type)
410404

411405
for (int j = 0; j < dataList.Count; j++)
412406
{
413-
bool includeInResult = IncludeInResult(i, j);
414407
byte index = (byte)Math.Min(j % 3, 1);
415408
int? intValue = (index == 1) ? dataList[j] : null;
416409
string stringValue = (index == 1) ? null : dataList[j]?.ToString();
417410
typeBuilder.Append(index);
418-
if (includeInResult)
419-
{
420-
typeResultBuilder.Append(index);
421-
}
411+
typeResultBuilder.Append(index);
422412

423413
if (isDense)
424414
{

0 commit comments

Comments
 (0)