Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
It's often the case that data being read/written in arrow format is part of some larger protocol. However, ArrowStreamWriter and ArrowStreamReader close the provided stream when they're disposed. This means that if you need to, for example, write a footer after the arrow data is written, you need to actually construct the ArrowStreamWriter around some temporary stream, write to that, then copy the data from that stream to the actual one that you then write the footer to; otherwise, ArrowStreamWriter will end up disposing of the stream before you have the opportunity to write the footer.
Throughout .NET, this approach is generally codified as a ctor that takes a "leaveOpen" Boolean parameter, e.g. as on System.IO.StreamWriter (https://docs.microsoft.com/en-us/dotnet/api/system.io.streamwriter.-ctor?view=netframework-4.7.2#System_IO_StreamWriter__ctor_System_IO_Stream_System_Text_Encoding_System_Int32_System_Boolean_) or System.IO.DeflateStream (https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.deflatestream.-ctor?view=netframework-4.7.2#System_IO_Compression_DeflateStream__ctor_System_IO_Stream_System_IO_Compression_CompressionLevel_System_Boolean_).
ArrowStreamReader and ArrowStreamWriter should do the same:
public ArrowStreamReader(Stream stream, bool leaveOpen);
public ArrowStreamWriter(Stream baseStream, Schema schema, bool leaveOpen);
Attachments
Issue Links
- links to