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:

FieldSize
Schema version2 bytes
Flags2 byte
Key columns hash4 bytes
Key chunk:
Key chunk size
4 bytes
Null-mapnumber of columns / 8
Flags1 byte
Variable-length columns offsets table size2 bytes
Variable-length columns offsets tableVariable (number of non-null varlen columns * 4)
Fix-sized columns valuesVariable
Variable-length columns valuesVariable
Value chunk:
Value chunk size4 bytes
Flags1 byte
Null-map

(number of columns / 8

) -

If the value columns contains nullable column:
0 bytes - otherwise
Variable-length  columns offsets table size2 bytes
Variable-length  columns offsets tableVariable (number of non-null varlen columns * 4)
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.

...

The flags field is a bitmask with each bit treated as a flag, with the following flags available (from flag 0 being the LSB to flag 7 being MSB):

Flags BitsDescription

...

0

...

, 1

VarTable formats:

  • (0, 0) - SKIPPED.  VarTable for chunk is omitted  (all column values in the chunk either of fix-sized type or null);
  • (0, 1) - TINY format (1 byte for offset);
  • (1, 0) - MEDIUM format (2 bytes for offset);
  • (1, 1) - LARGE format (4 bytes for offset)
2-7Reserverd

...


Hash calculation and key comparison

...