eerhardt commented on a change in pull request #10527: URL: https://github.com/apache/arrow/pull/10527#discussion_r666493486
########## File path: csharp/src/Apache.Arrow/Ipc/ArrowStreamWriter.cs ########## @@ -723,4 +868,62 @@ public virtual void Dispose() } } } + + internal static class DictionaryCollector + { + internal static void Collect(RecordBatch recordBatch, ref DictionaryMemo dictionaryMemo) + { + Schema schema = recordBatch.Schema; + for (int i = 0; i < schema.Fields.Count; i++) + { + { + Field field = schema.GetFieldByIndex(i); + IArrowArray array = recordBatch.Column(i); + + CollectDictionary(field, array, ref dictionaryMemo); + } + } + } + + private static void CollectDictionary(Field field, IArrowArray array, ref DictionaryMemo dictionaryMemo) + { + if (field.DataType.TypeId == ArrowTypeId.Dictionary) + { + IArrowArray dictionary = (array as DictionaryArray).Dictionary; + dictionaryMemo ??= new DictionaryMemo(); + long id = dictionaryMemo.GetOrAssignId(field); + + dictionaryMemo.AddOrReplaceDictionary(id, dictionary); + WalkChildren(dictionary, ref dictionaryMemo); Review comment: Do we have a test for a DictionaryArray with children? -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org