Expand description
Array column type (Array(T)).
Array column implementation
ClickHouse Documentation: https://clickhouse.com/docs/en/sql-reference/data-types/array
§Overview
Array columns store variable-length arrays of elements. All elements are stored in a single nested column (flattened), with offsets tracking where each array begins/ends.
§Important Restriction
Arrays cannot be wrapped in Nullable:
- ❌
Nullable(Array(String))- Error: “Nested type Array(String) cannot be inside Nullable type” (Error code 43) - ✅
Array(Nullable(String))- CORRECT: Each element can be NULL
If you need to represent “no array”, use an empty array [] instead of
NULL.
See: https://github.com/ClickHouse/ClickHouse/issues/1062
§Wire Format
[offsets: UInt64 * num_arrays] // Cumulative element counts
[nested_column_data] // All elements concatenatedExample: [[1,2], [3], [4,5,6]]
- Offsets:
[2, 3, 6](2 elements in first array, 3 total after second, 6 total after third) - Nested data:
[1, 2, 3, 4, 5, 6]
Structs§
- Column
Array - Column for arrays of variable length
- Column
ArrayT - Typed wrapper for ColumnArray that provides type-safe access to nested column