tustvold commented on issue #5052:
URL: https://github.com/apache/arrow-rs/issues/5052#issuecomment-1800852211

   Annotating the relevant RecordBatch we get
   
   Good
   
   ```
   0x14, 0x00, 0x00, 0x00, // Message offset (20)
   0x00, 0x00, 0x00, 0x00, // Message VTable
   0x0c, 0x00, // VTable length (12)
   0x16, 0x00, // Object size (22)
   0x0e, 0x00, // Field 0 offset (version) (14)
   0x15, 0x00, // Field 1 offset (header type) (21)
   0x10, 0x00, // Field 2 offset (header offset) (16)
   0x04, 0x00, // Field 3 offset (bodyLength) (4)
   // Message table
   0x0c, 0x00, 0x00, 0x00, // SOffset to VTable (12)
   0x18, 0x00, 0x00, 0x00, // (bodyLength) (24)
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Padding
   0x04, 0x00, // (version)
   0x10, 0x00, 0x00, 0x00, // Offset to RecordBatch (16)
   0x00, 0x03, // (header type)  (RecordBatch)
   // End of Message
   
   // RecordBatch VTable
   0x0a, 0x00, // VTable length (10)
   0x18, 0x00, // Object size (24)
   0x0c, 0x00, // Field 0 offset (length) (12)
   0x08, 0x00, // Field 1 offset (nodes) (8)
   0x04, 0x00, // Field 2 offset (buffers) (4)
   // RecordBatch table
   0x0a, 0x00, 0x00, 0x00, // SOffset to VTable (10)
   0x14, 0x00, 0x00, 0x00, // Offset to buffers
   0x48, 0x00, 0x00, 0x00, // Offset to nodes (72
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Length
   0x00, 0x00, 0x00, 0x00, //
   // Buffers
   0x03, 0x00, 0x00, 0x00, // Vector Length 3
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Offset 0
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Length 1
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Offset 8
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Length 8
   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Offset 16
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer Length 8
   // Nodes
   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // Vector Length 1
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // FieldNode Length 1
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // FieldNode Null Count 0
   ```
   
   Bad
   
   ```
   0x10, 0x00, 0x00, 0x00, // Message offset (16)
   // Message VTable
   0x0c, 0x00, // VTable length (12)
   0x1a, 0x00, // Object size (26)
   0x18, 0x00, // Field 0 offset (version) (24)
   0x17, 0x00, // Field 1 offset (header type) (23)
   0x04, 0x00, // Field 2 offset (header offset) (4)
   0x08, 0x00, // Field 3 offset (bodyLength) (8)
   // Message table
   0x0c, 0x00, 0x00, 0x00, // SOffset to VTable (12)
   0x20, 0x00, 0x00, 0x00, // Offset to header (32)
   0x18, 0x00, 0x00, 0x00, // (bodyLength) (8)
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x03, // (header type) (RecordBatch)
   0x04, 0x00, // (version)
   // End of Message
   
   // RecordBatch VTable
   0x0a, 0x00, // VTable length (10)
   0x14, 0x00, // Object Size (20)
   0x0c, 0x00, // Field 0 offset (length) (12)
   0x08, 0x00, // Field 1 offset (nodes) (8)
   0x04, 0x00, // Field 2 offset (buffers) (4)
   // RecordBatch table
   0x0a, 0x00, 0x00, 0x00, // SOffset to VTable (10)
   0x24, 0x00, 0x00, 0x00, // Offset to buffers
   0x0c, 0x00, 0x00, 0x00, // Offset to nodes
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Length
   // Nodes
   0x01, 0x00, 0x00, 0x00, // Vector length 1
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // FieldNode length 1
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // FieldNode null count 0
   // Buffers
   0x03, 0x00, 0x00, 0x00, // Vector length 3
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer offset 0
   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer length 1
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer offset 8
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer length 8
   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer offset 16
   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Buffer length 8
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   ```
   
   In the bad example we can see that the vectors don't contain padding to 
align them to an 8 byte boundary, instead they only have 4 byte alignment. This 
in turn means that the structs are not correctly aligned, which I suspect is 
what flatcc is then complaining about.
   
   


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