Expand description
ClickHouse type system and type string parser.
§ClickHouse Type System
This module implements the ClickHouse type system for the native TCP protocol.
§ClickHouse Documentation References
§Numeric Types
- Integer Types
- Int8/16/32/64/128, UInt8/16/32/64/128
- Floating-Point Types
- Float32, Float64
- Decimal Types
- Decimal, Decimal32/64/128
§String Types
- String
- Variable-length strings
- FixedString
- Fixed-length binary strings
§Date and Time Types
- Date - Days since 1970-01-01
- Date32
- Extended date range
- DateTime
- Unix timestamp (UInt32)
- DateTime64
- High precision timestamp (Int64)
§Compound Types
§Special Types
- Nullable
- Adds NULL support to any type
- LowCardinality
- Dictionary encoding for compression
- Enum8/Enum16
- Enumerated values
- UUID - Universally unique identifiers
- IPv4/IPv6
- IP addresses
§Geo Types
- Point - 2D point (Tuple(Float64, Float64))
- Ring - Array of Points
- Polygon - Array of Rings
- MultiPolygon
- Array of Polygons
§Type Nesting Rules
ClickHouse enforces strict type nesting rules (Error code 43:
ILLEGAL_TYPE_OF_ARGUMENT):
✅ Allowed:
Array(Nullable(T))- Array where each element can be NULLLowCardinality(Nullable(T))- Dictionary-encoded nullable valuesArray(LowCardinality(T))- Array of dictionary-encoded valuesArray(LowCardinality(Nullable(T)))- Combination of all three
❌ NOT Allowed:
Nullable(Array(T))- Arrays themselves cannot be NULL (use empty array instead)Nullable(LowCardinality(T))- Wrong nesting orderNullable(Nullable(T))- Double-nullable is invalid
For more details, see the column module documentation.
Structs§
- Enum
Item - Enum item for Enum8/Enum16 types, mapping a name to its integer value.
- TypeAst
- Abstract Syntax Tree for a type definition
Mirrors C++
struct TypeAst
Enums§
- Type
- ClickHouse type definition, representing both simple and parametric types.
- Type
Code - Type code enumeration matching ClickHouse types
- Type
Meta - TypeAst meta-type classification
Mirrors C++
TypeAst::Meta
Traits§
- ToType
- Trait for mapping Rust primitive types to ClickHouse types
Equivalent to C++
Type::CreateSimple<T>()template specializations
Functions§
- parse_
type_ name - Parse a type name and return cached AST
Mirrors C++
const TypeAst* ParseTypeName(const std::string& type_name)