...
Field | Size | Comments |
---|---|---|
Schema version | 2 bytes. | short number. The possible values are:
|
Key columns hash | 4 bytes | |
Key chunk: | ||
Key chunk size | 4 bytes | |
Flags | 1 byte | |
Variable-length columns offsets table size | 0-2 or 0 bytes |
|
Variable-length columns offsets table | Variable (number of non-null varlen columns * <format_size>) | <format_size> - depends on the Flags field. See the table below |
Fix-sized columns values | Variable | |
Variable-length columns values | Variable | |
Value chunk: | ||
Value chunk size | 4 bytes | |
Flags | 1 byte | |
Null-map | (number of columns / 8 ) or 0 bytes | Zero size if and only if schema has no nullable columns |
Variable-length columns offsets table size | 2 or 0 bytes |
|
Variable-length columns offsets table | Variable (number of non-null varlen columns * <format_size>) | <format_size> - depends on the Flags field. See the table below |
Fix-sized columns values | Variable | |
Variable-length columns values | Variable |
...
The flags field is used to detect the format. We propose 3 formats for a vartable: tiny, medium, and large with offset fields sizes of byte, short, and int respectively.
Vartable length field is the size of byte for tiny format and the size of short for others. .
Vertable length is calculated as: <count_of _not_null_varlen_fields> - 1. The offset for the first varlen field is not stored at the table. It is calculated as the begin of the varlen values block.
IMPORTANT: having multiple formats MUST guarantee the key (as well as value) chunk will be always written in a single possible way to allow comparing chunks of rows of the same version as just byte arrays.
...