Skip to content

Apache DataFusion SQL Query Engine

ARROW-1343: [Java] Aligning serialized schema, end of buffers in RecordBatches

Emilio Lahr-Vivaz908bbda67c44
diff --git a/format/IPC.md b/format/IPC.md
index 3fd234e4aa..2f79031443 100644
--- a/format/IPC.md
+++ b/format/IPC.md
@@ -27,7 +27,7 @@ Data components in the stream and file formats are represented as encapsulated
* A length prefix indicating the metadata size
* The message metadata as a [Flatbuffer][3]
* Padding bytes to an 8-byte boundary
-* The message body
+* The message body, which must be a multiple of 8 bytes
Schematically, we have:
@@ -38,6 +38,10 @@ Schematically, we have:
<message body>
```
+The complete serialized message must be a multiple of 8 bytes so that messages
+can be relocated between streams. Otherwise the amount of padding between the
+metadata and the message body could be non-deterministic.
+
The `metadata_size` includes the size of the flatbuffer plus padding. The
`Message` flatbuffer includes a version number, the particular message (as a
flatbuffer union), and the size of the message body:
@@ -154,6 +158,10 @@ struct Block {
}
```
+The `metaDataLength` here includes the metadata length prefix, serialized
+metadata, and any additional padding bytes, and by construction must be a
+multiple of 8 bytes.
+
Some notes about this
* The `Block` offset indicates the starting byte of the record batch.