keshen-msft opened a new issue, #41110:
URL: https://github.com/apache/arrow/issues/41110

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   When input stream is empty, the reader throws exception when reading the 
schema, refer to 
https://github.com/apache/arrow/blob/cd607d00b9e3c5f2ac2a2e373ba7571fd75fc725/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs#L157.
 Exception details:
   
   System.InvalidOperationException
     HResult=0x80131509
     Message=Unexpectedly reached the end of the stream before a full buffer 
was read.
     Source=Apache.Arrow
     StackTrace:
      at 
Apache.Arrow.Ipc.ArrowStreamReaderImplementation.EnsureFullRead(Memory`1 
buffer, Int32 bytesRead) in 
/arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs:line 276
      at 
Apache.Arrow.Ipc.ArrowStreamReaderImplementation.ReadMessageLength(Boolean 
throwOnFullRead) in 
/arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs:line 238
      at Apache.Arrow.Ipc.ArrowStreamReaderImplementation.ReadSchema() in 
/arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs:line 179
      at Apache.Arrow.Ipc.ArrowStreamReaderImplementation.ReadRecordBatch() in 
/arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs:line 106
      at Apache.Arrow.Ipc.ArrowStreamReaderImplementation.ReadNextRecordBatch() 
in /arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs:line 53
      at Apache.Arrow.Ipc.ArrowStreamReader.ReadNextRecordBatch() in 
/arrow/csharp/src/Apache.Arrow/Ipc/ArrowStreamReader.cs:line 107
   ...
   
   On the other hand, javascript handles such input. And C++ lib also handles 
it, refer to 
https://github.com/apache/arrow/blob/cd607d00b9e3c5f2ac2a2e373ba7571fd75fc725/cpp/src/arrow/ipc/reader.cc#L1109C7-L1111C10.
 The behavior in javascript and C++ is that null RecordBatch is returned.
   
   ### Component(s)
   
   C#


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