Skip to main content
Skip to main content
Edit this page

Native protocol column types

See Data Types for general reference.

Tip

Numeric types encoding matches memory layout of little endian CPUs like AMD64 or ARM64, allowing very efficient encoding and decoding.

TypeEncoding
Integers (Int/UInt)8, 16, 32, 64, 128 or 256 bits in little endian
Floats (Float32/Float64)IEEE 754 binary representation
StringArray of strings as (len, value)
FixedString(N)Array of N-byte sequences
IPv4Alias of UInt32, represented as UInt32
IPv6Alias of FixedString(16), represented as binary
TupleArray of columns encoded continuously. Example: Tuple(String, UInt8) = two continuous columns
MapMap(K, V) = three columns: Offsets ColUInt64, Keys K, Values V. Row count in Keys/Values = last Offsets value
ArrayArray(T) = two columns: Offsets ColUInt64, Data T. Row count in Data = last Offsets value
NullableNullable(T) = two columns: Nulls ColUInt8, Values T with same row count. Nulls is mask: 1=null, 0=value
UUIDAlias of FixedString(16), represented as binary
EnumAlias of Int8 or Int16, each integer mapped to a String value
LowCardinalityLowCardinality(T) = two columns: Index T, Keys K where K is UInt8/16/32/64. Index contains unique values, Keys contains indexes into Index
BoolAlias of UInt8: 0=false, 1=true

Example: Nullable encoding

To encode [null, "", "hello", null, "world"]:
  Values: ["", "", "hello", "", "world"] (len: 5)
  Nulls:  [ 1,  0,       0,  1,       0] (len: 5)

Example: LowCardinality encoding

To encode ["Eko", "Eko", "Amadela", "Amadela", "Amadela", "Amadela"]:
  Index: ["Eko", "Amadela"] (String)
  Keys:  [0, 0, 1, 1, 1, 1] (UInt8)