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


##########
src/Apache.Arrow.Flight/Internal/FlightDataStream.cs:
##########
@@ -74,25 +68,28 @@ public async Task Write(RecordBatch recordBatch, ByteString 
applicationMetadata)
             }
             ResetStream();
 
-            _currentFlightData = new Protocol.FlightData();
-
-            if (applicationMetadata != null)
-            {
-                _currentFlightData.AppMetadata = applicationMetadata;
-            }
+            // Attached to the record-batch message, not to any preceding 
dictionary messages.
+            _recordBatchAppMetadata = applicationMetadata;
 
+            // Writes any dictionary-batch messages followed by the 
record-batch message. Each is
+            // flushed as its own FlightData frame (see WriteMessageAsync) so 
that dictionary batches
+            // are delivered before the record batch that references them.
             await WriteRecordBatchInternalAsync(recordBatch, customMetadata: 
null).ConfigureAwait(false);

Review Comment:
   This still inherits `ArrowStreamWriter`'s one-time 
`HasWrittenDictionaryBatch` gate, so after the first `Write` no dictionary 
message is emitted for later record batches. If a later batch carries a 
replacement/new dictionary (the Flight issue calls for dictionaries to be 
resent per batch), its indices are decoded against the first batch's dictionary 
and yield incorrect values; please resend/recollect the dictionaries for each 
Flight batch or implement explicit reuse/delta handling.



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