Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Given a set of user-defined columns, this set is then rearranged so that fixed-sized columns go first. This sorted set of columns is used to form a row. Row layout is as follows:

Field

Size

/

Comments
Schema version2 bytes.
Key columns hash4 bytesKey chunk:Key chunk size
4 bytesFlags1 byteVariable-length columns offsets table size2 bytesVariable-length columns offsets table

short number. The possible values are:

  • positive - regular row: key  and value chunks are present;
  • 0 - no value. If the flag is set, the value chunk is omitted, e.g. the row represents a tombstone or key-row to lookup by the key;
  • negative - invalid schema version.
Key columns hash4 bytes
Key chunk:

Key chunk size
4 bytes
Flags1 byte
Variable-length columns offsets table size2 bytes
Variable-length columns offsets table
Variable (number of non-null varlen
columns * <format_size>)
columns * <format_size>)<format_size> - depends on the Flags field. See the table below
Fix-sized columns valuesVariable
Variable-length columns valuesVariable
Value chunk:

Value chunk size4 bytes
Flags1 byte
Null-map

(number of columns / 8 ) or

0  - zero

0 bytes

Zero size if and only if schema has no nullable columns
Variable-length  columns offsets table size2 bytes
Variable-length  columns offsets tableVariable (number of non-null varlen columns * <format_size>
)Fix-sized columns valuesVariableVariable-length columns valuesVariable

Schema version is the short number. The possible values are:

...

)<format_size> - depends on the Flags field. See the table below
Fix-sized columns valuesVariable
Variable-length columns valuesVariable

...


For the small rows, the metadata sizes may introduce a very noticeable overhead, so it looks reasonable to write them in a more compact way using different techniques.

...