emkornfield commented on a change in pull request #7326: URL: https://github.com/apache/arrow/pull/7326#discussion_r464025134
########## File path: java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java ########## @@ -266,8 +266,15 @@ public static ArrowBlock serialize(WriteChannel out, ArrowRecordBatch batch, Ipc long bufferLength = writeBatchBuffers(out, batch); Preconditions.checkArgument(bufferLength % 8 == 0, "out is not aligned"); + long compLength = 0L; + if (batch.getBodyCompression() != null) { + compLength = writeCompressionBody(out, batch.getBodyCompression()); + Preconditions.checkArgument(compLength == ArrowBodyCompression.BODY_COMPRESSION_LENGTH, Review comment: Could you add a comment here on why we need to verify this value here?. Also, it looks like align() is called in this method, so couldn't that cause these values to be unequal ########## File path: java/vector/src/main/java/org/apache/arrow/vector/ipc/message/MessageSerializer.java ########## @@ -266,8 +266,15 @@ public static ArrowBlock serialize(WriteChannel out, ArrowRecordBatch batch, Ipc long bufferLength = writeBatchBuffers(out, batch); Preconditions.checkArgument(bufferLength % 8 == 0, "out is not aligned"); + long compLength = 0L; + if (batch.getBodyCompression() != null) { + compLength = writeCompressionBody(out, batch.getBodyCompression()); + Preconditions.checkArgument(compLength == ArrowBodyCompression.BODY_COMPRESSION_LENGTH, + "deserialized compression body length not equal to ArrowBodyCompression#BODY_COMPRESSION_LENGTH"); Review comment: included sizes here would be useful. ---------------------------------------------------------------- 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