emkornfield commented on a change in pull request #9147: URL: https://github.com/apache/arrow/pull/9147#discussion_r596528147
########## File path: java/flight/flight-core/src/main/java/org/apache/arrow/flight/ArrowMessage.java ########## @@ -332,6 +333,23 @@ private static ArrowMessage frame(BufferAllocator allocator, final InputStream s } + /** + * Get first byte with EOF check, it is especially needed when using grpc compression. + * InflaterInputStream need another read to change reachEOF after all bytes has been read. + * + * @param is InputStream + * @return -1 if stream is not available, otherwise it will return the actual value. + * @throws IOException Read first byte failed. + */ + private static int readRawVarint32WithEOFCheck(InputStream is) throws IOException { + int firstByte = is.read(); Review comment: I agree with @lidavidm another scenario where zero is perfectly allowable is when no data is buffered but EOF hasn't been reached. @stczwd do you think you will be able to revise the PR to fix the underlying issue? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org