-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-41198: [C#] Fix concatenation of union arrays #41226
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,6 @@ public void TestStandardCases() | |
{ | ||
foreach ((List<IArrowArray> testTargetArrayList, IArrowArray expectedArray) in GenerateTestData()) | ||
{ | ||
if (expectedArray is UnionArray) | ||
{ | ||
// Union array concatenation is incorrect. See https://github.com/apache/arrow/issues/41198 | ||
continue; | ||
} | ||
|
||
IArrowArray actualArray = ArrowArrayConcatenator.Concatenate(testTargetArrayList); | ||
ArrowReaderVerifier.CompareArrays(expectedArray, actualArray); | ||
} | ||
|
@@ -604,10 +598,11 @@ public void Visit(UnionType type) | |
|
||
for (int j = 0; j < dataList.Count; j++) | ||
{ | ||
byte index = (byte)Math.Max(j % 3, 1); | ||
byte index = (byte)Math.Min(j % 3, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure this was the intended behaviour, otherwise the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the original code, the indexes would be 1, 1, 2, 1, 1, 2, etc.. With this change, the indexes would be 0, 1, 1, 0, 1, 1, etc. |
||
int? intValue = (index == 1) ? dataList[j] : null; | ||
string stringValue = (index == 1) ? null : dataList[j]?.ToString(); | ||
typeBuilder.Append(index); | ||
typeResultBuilder.Append(index); | ||
|
||
if (isDense) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the offset here but I haven't tested this works fully with sliced arrays, I'll follow up on this in #41164.