1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//! # Column Module
//!
//! This module provides implementations for all ClickHouse column types used
//! in the native TCP protocol.
//!
//! ## ClickHouse Documentation
//!
//! - [Data Types Overview](https://clickhouse.com/docs/en/sql-reference/data-types)
//! - [Nullable Type](https://clickhouse.com/docs/en/sql-reference/data-types/nullable)
//! - [Array Type](https://clickhouse.com/docs/en/sql-reference/data-types/array)
//! - [LowCardinality Type](https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality)
//! - [Tuple Type](https://clickhouse.com/docs/en/sql-reference/data-types/tuple)
//! - [Map Type](https://clickhouse.com/docs/en/sql-reference/data-types/map)
//!
//! ## Type Nesting Restrictions
//!
//! ClickHouse enforces strict rules about type nesting. The following
//! combinations are **NOT allowed**:
//!
//! | Invalid Nesting | Error | Workaround |
//! |----------------|-------|------------|
//! | `Nullable(Array(...))` | "Nested type Array(...) cannot be inside Nullable type" (Error 43) | Use `Array(Nullable(...))` |
//! | `Nullable(LowCardinality(...))` | "Nested type LowCardinality(...) cannot be inside Nullable type" | Use `LowCardinality(Nullable(...))` |
//! | `Nullable(Array(LowCardinality(...)))` | Same as above | Use `Array(LowCardinality(Nullable(...)))` or `Array(Nullable(LowCardinality(...)))` |
//!
//! **Correct Nesting Order:**
//! - ✅ `Array(Nullable(T))` - Array of nullable elements
//! - ✅ `Array(LowCardinality(T))` - Array of low-cardinality elements
//! - ✅ `Array(LowCardinality(Nullable(T)))` - Array of nullable
//! low-cardinality elements
//! - ✅ `LowCardinality(Nullable(T))` - Low-cardinality column with nullable
//! values
//!
//! **References:**
//! - [ClickHouse Issue #1062](https://github.com/ClickHouse/ClickHouse/issues/1062)
//! - Arrays cannot be nullable
//! - [ClickHouse Issue #42456](https://github.com/ClickHouse/ClickHouse/issues/42456)
//! - LowCardinality cannot be inside Nullable
/// Array column type (`Array(T)`).
/// Column value extraction and insertion helpers.
/// Date and DateTime column types.
/// Decimal column types (`Decimal32`, `Decimal64`, `Decimal128`).
/// Enum8 and Enum16 column types.
/// Geo type helpers (Point, Ring, Polygon, MultiPolygon).
/// IPv4 column type.
/// IPv6 column type.
/// LowCardinality column type (dictionary encoding).
/// Map column type (`Map(K, V)`).
/// Nothing/Void column type.
/// Nullable column type (`Nullable(T)`).
/// Numeric column types (integers, floats, bool).
/// String and FixedString column types.
/// Tuple column type (`Tuple(T1, T2, ...)`).
/// UUID column type.
// Re-export column types for easier access
pub use ;
pub use ;
pub use ColumnDecimal;
pub use ;
pub use ColumnIpv4;
pub use ColumnIpv6;
pub use ColumnLowCardinality;
pub use ColumnMap;
pub use ColumnNothing;
pub use ColumnNullable;
pub use *;
pub use ;
pub use ColumnTuple;
pub use ;
use crate::;
use BytesMut;
use Arc;
/// Reference to a column (using Arc for cheap cloning)
pub type ColumnRef = ;
/// Base trait for all column types
/// Note: We use byte buffers instead of generic readers/writers to make the
/// trait dyn-compatible
/// Helper trait for column types that can be downcasted
/// Trait for columns that support iteration over their values.