Copilot commented on code in PR #450:
URL: https://github.com/apache/arrow-dotnet/pull/450#discussion_r4116149110
##########
src/Apache.Arrow/Arrays/ArrayDataConcatenator.cs:
##########
@@ -125,6 +127,200 @@ public void Visit(FixedWidthType type)
Result = new ArrayData(resolvedType, _totalLength,
_totalNullCount, 0, new ArrowBuffer[] { validityBuffer, valueBuffer });
}
+ public void Visit(NullType type)
+ {
+ foreach (ArrayData arrayData in _arrayDataList)
+ {
+ arrayData.EnsureDataType(type.TypeId);
+ }
+
+ // A null array has no buffers; every slot is null.
+ Result = new ArrayData(type, _totalLength, _totalLength, 0,
System.Array.Empty<ArrowBuffer>());
+ }
+
+ public void Visit(DictionaryType type)
+ {
+ CheckData(type, 2);
+ var indexType = (IntegerType)type.IndexType;
+
+ // Inputs with no rows don't contribute any dictionary entries.
+ var contributing = new List<ArrayData>(_arrayDataList.Count);
+ foreach (ArrayData arrayData in _arrayDataList)
+ {
+ var otherType = (DictionaryType)arrayData.DataType;
+ if (otherType.IndexType.TypeId != indexType.TypeId)
+ {
+ throw new ArgumentException(
+ $"Cannot concatenate dictionary arrays with
different index types: {indexType.Name} vs {otherType.IndexType.Name}");
Review Comment:
The result always uses the first input's `DictionaryType`, including its
`Ordered` flag, but the fallback dictionary is built by appending dictionaries
end to end. If the first dictionary is marked ordered, inputs such as `[b]`
followed by `[a]` produce `[b, a]` while still advertising an ordered
dictionary, which is false. Reject incompatible ordered inputs or construct a
non-ordered result when dictionaries must be combined.
This issue also appears on line 156 of the same file.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]