@@ -122,6 +122,9 @@ func TestColumnarMap(t *testing.T) {
122
122
Col1 Map(String, UInt64)
123
123
, Col2 Map(String, UInt64)
124
124
, Col3 Map(String, UInt64)
125
+ , Col4 Map(Enum16('one' = 1, 'two' = 2), UInt64)
126
+ , Col5 Map(String, Enum16('one' = 1, 'two' = 2))
127
+ , Col6 Map(Enum8('one' = 1, 'two' = 2), Enum8('red' = 1, 'blue' = 2))
125
128
) Engine MergeTree() ORDER BY tuple()
126
129
`
127
130
defer func () {
@@ -134,6 +137,9 @@ func TestColumnarMap(t *testing.T) {
134
137
col1Data = []map [string ]uint64 {}
135
138
col2Data = []map [string ]uint64 {}
136
139
col3Data = []map [string ]uint64 {}
140
+ col4Data = []map [string ]uint64 {}
141
+ col5Data = []map [string ]string {}
142
+ col6Data = []map [string ]string {}
137
143
)
138
144
for i := 0 ; i < 100 ; i ++ {
139
145
col1Data = append (col1Data , map [string ]uint64 {
@@ -145,17 +151,35 @@ func TestColumnarMap(t *testing.T) {
145
151
fmt .Sprintf ("key_col_2_%d_2" , i ): uint64 (i ),
146
152
})
147
153
col3Data = append (col3Data , map [string ]uint64 {})
154
+ col4Data = append (col4Data , map [string ]uint64 {
155
+ "one" : uint64 (i ),
156
+ "two" : uint64 (i ),
157
+ })
158
+ col5Data = append (col5Data , map [string ]string {
159
+ fmt .Sprintf ("key_col_2_%d_1" , i ): "one" ,
160
+ fmt .Sprintf ("key_col_2_%d_2" , i ): "two" ,
161
+ })
162
+ col6Data = append (col6Data , map [string ]string {
163
+ "one" : "red" ,
164
+ "two" : "blue" ,
165
+ })
148
166
}
149
167
require .NoError (t , batch .Column (0 ).Append (col1Data ))
150
168
require .NoError (t , batch .Column (1 ).Append (col2Data ))
151
169
require .NoError (t , batch .Column (2 ).Append (col3Data ))
170
+ require .NoError (t , batch .Column (3 ).Append (col4Data ))
171
+ require .NoError (t , batch .Column (4 ).Append (col5Data ))
172
+ require .NoError (t , batch .Column (5 ).Append (col6Data ))
152
173
require .Equal (t , 100 , batch .Rows ())
153
174
require .NoError (t , batch .Send ())
154
175
{
155
176
var (
156
177
col1 map [string ]uint64
157
178
col2 map [string ]uint64
158
179
col3 map [string ]uint64
180
+ col4 map [string ]uint64
181
+ col5 map [string ]string
182
+ col6 map [string ]string
159
183
col1Data = map [string ]uint64 {
160
184
"key_col_1_10_1" : 10 ,
161
185
"key_col_1_10_2" : 10 ,
@@ -165,11 +189,26 @@ func TestColumnarMap(t *testing.T) {
165
189
"key_col_2_10_2" : 10 ,
166
190
}
167
191
col3Data = map [string ]uint64 {}
192
+ col4Data = map [string ]uint64 {
193
+ "one" : 10 ,
194
+ "two" : 10 ,
195
+ }
196
+ col5Data = map [string ]string {
197
+ "key_col_2_10_1" : "one" ,
198
+ "key_col_2_10_2" : "two" ,
199
+ }
200
+ col6Data = map [string ]string {
201
+ "one" : "red" ,
202
+ "two" : "blue" ,
203
+ }
168
204
)
169
- require .NoError (t , conn .QueryRow (ctx , "SELECT * FROM test_map WHERE Col1['key_col_1_10_1'] = $1" , 10 ).Scan (& col1 , & col2 , & col3 ))
205
+ require .NoError (t , conn .QueryRow (ctx , "SELECT * FROM test_map WHERE Col1['key_col_1_10_1'] = $1" , 10 ).Scan (& col1 , & col2 , & col3 , & col4 , & col5 , & col6 ))
170
206
assert .Equal (t , col1Data , col1 )
171
207
assert .Equal (t , col2Data , col2 )
172
208
assert .Equal (t , col3Data , col3 )
209
+ assert .Equal (t , col4Data , col4 )
210
+ assert .Equal (t , col5Data , col5 )
211
+ assert .Equal (t , col6Data , col6 )
173
212
}
174
213
}
175
214
0 commit comments