owencorrigan commented on code in PR #433:
URL: https://github.com/apache/arrow-dotnet/pull/433#discussion_r4684093029


##########
src/Apache.Arrow/Ipc/ArrowStreamWriter.cs:
##########
@@ -1570,12 +1570,15 @@ public virtual void Dispose()
 
     internal static class DictionaryCollector
     {
-        internal static void Collect(RecordBatch recordBatch, ref 
DictionaryMemo dictionaryMemo)
+        // Dictionary ids were assigned to the writer schema's own Field 
instances when the
+        // schema was serialized, and DictionaryMemo keys on Field reference 
identity — a batch
+        // built with its own (value-equal) Schema would be minted a fresh, 
undeclared id.
+        // Resolve ids against the writer's schema; only take column data from 
the batch.
+        internal static void Collect(Schema writerSchema, RecordBatch 
recordBatch, ref DictionaryMemo dictionaryMemo)
         {
-            Schema schema = recordBatch.Schema;
-            for (int i = 0; i < schema.FieldsList.Count; i++)
+            for (int i = 0; i < writerSchema.FieldsList.Count; i++)
             {
-                Field field = schema.GetFieldByIndex(i);
+                Field field = writerSchema.GetFieldByIndex(i);
                 IArrowArray array = recordBatch.Column(i);

Review Comment:
   I don't think this is correct.  The test 
TestGetRecordBatchesWithDistinctSchemaInstancesPerBatch is passing for me 
locally. 
   
   >> the record batch header is encoded with a newly assigned ID
   RecordBatch only has length, field nodes, buffers, and compression, no ID 
field



-- 
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]

Reply via email to