> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 原生协议列类型

> 原生协议的列类型

如需了解一般性参考信息，请参阅 [数据类型](/zh/reference/data-types/index)。

<Tip>
  数值类型的编码与 AMD64 或 ARM64 等小端 CPU 的内存布局一致，因此能够实现非常高效的编码和解码。
</Tip>

| 类型                                                          | 编码                                                                                               |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **整数** ([Int/UInt](/zh/reference/data-types/int-uint))      | 小端序的 8、16、32、64、128 或 256 位                                                                      |
| **浮点数** ([Float32/Float64](/zh/reference/data-types/float)) | IEEE 754 二进制表示                                                                                   |
| [String](/zh/reference/data-types/string)                   | 字符串数组，编码为 (len, value)                                                                           |
| [FixedString(N)](/zh/reference/data-types/fixedstring)      | N 字节序列数组                                                                                         |
| [IPv4](/zh/reference/data-types/ipv4)                       | `UInt32` 的别名，表示为 UInt32                                                                          |
| [IPv6](/zh/reference/data-types/ipv6)                       | `FixedString(16)` 的别名，表示为二进制                                                                     |
| [Tuple](/zh/reference/data-types/tuple)                     | 按顺序连续编码的列数组。示例：`Tuple(String, UInt8)` = 两个连续的列                                                   |
| [Map](/zh/reference/data-types/map)                         | `Map(K, V)` = 三列：`Offsets ColUInt64, Keys K, Values V`。Keys/Values 的行数 = Offsets 的最后一个值          |
| [Array](/zh/reference/data-types/array)                     | `Array(T)` = 两列：`Offsets ColUInt64, Data T`。Data 的行数 = Offsets 的最后一个值                            |
| [Nullable](/zh/reference/data-types/nullable)               | `Nullable(T)` = 两列：`Nulls ColUInt8, Values T`，且两者的行数相同。Nulls 是掩码：1=NULL，0=值                      |
| [UUID](/zh/reference/data-types/uuid)                       | `FixedString(16)` 的别名，表示为二进制                                                                     |
| [Enum](/zh/reference/data-types/enum)                       | `Int8` 或 `Int16` 的别名，每个整数都映射到一个 String 值                                                         |
| [LowCardinality](/zh/reference/data-types/lowcardinality)   | `LowCardinality(T)` = 两列：`Index T, Keys K`，其中 K 是 UInt8/16/32/64。Index 包含唯一值，Keys 包含指向 Index 的索引 |
| [Bool](/zh/reference/data-types/boolean)                    | `UInt8` 的别名：0=false，1=true                                                                       |

**示例：Nullable 编码**

```text theme={null}
To encode [null, "", "hello", null, "world"]:
  Values: ["", "", "hello", "", "world"] (len: 5)
  Nulls:  [ 1,  0,       0,  1,       0] (len: 5)
```

**示例：LowCardinality 编码**

```text theme={null}
To encode ["Eko", "Eko", "Amadela", "Amadela", "Amadela", "Amadela"]:
  Index: ["Eko", "Amadela"] (String)
  Keys:  [0, 0, 1, 1, 1, 1] (UInt8)
```
