@@ -16,14 +16,16 @@ var groupByTests = TableTest{
16
16
srcHdr ("d1" , fldTypeDecimal2 ),
17
17
srcHdr ("s1" , fldTypeString ),
18
18
srcHdr ("i2" , fldTypeInt , "min 0" , "max 1000" ),
19
+ srcHdr ("is1" , fldTypeIDSet ),
20
+ srcHdr ("id1" , fldTypeID ),
19
21
),
20
22
srcRows (
21
- srcRow (int64 (1 ), int64 (10 ), float64 (10 ), string ("10" ), int64 (100 )),
22
- srcRow (int64 (2 ), int64 (10 ), float64 (10 ), string ("10" ), int64 (200 )),
23
- srcRow (int64 (3 ), int64 (11 ), float64 (11 ), string ("11" ), nil ),
24
- srcRow (int64 (4 ), int64 (12 ), float64 (12 ), string ("12" ), nil ),
25
- srcRow (int64 (5 ), int64 (12 ), float64 (12 ), string ("12" ), nil ),
26
- srcRow (int64 (6 ), int64 (13 ), float64 (13 ), string ("13" ), nil ),
23
+ srcRow (int64 (1 ), int64 (10 ), float64 (10 ), string ("10" ), int64 (100 ), [] int64 { 1 , 2 }, int64 ( 1 ) ),
24
+ srcRow (int64 (2 ), int64 (10 ), float64 (10 ), string ("10" ), int64 (200 ), [] int64 { 1 , 2 }, int64 ( 2 ) ),
25
+ srcRow (int64 (3 ), int64 (11 ), float64 (11 ), string ("11" ), nil , [] int64 { 1 , 3 }, int64 ( 3 ) ),
26
+ srcRow (int64 (4 ), int64 (12 ), float64 (12 ), string ("12" ), nil , [] int64 { 2 , 3 }, int64 ( 4 ) ),
27
+ srcRow (int64 (5 ), int64 (12 ), float64 (12 ), string ("12" ), nil , [] int64 { 1 , 3 }, int64 ( 1 ) ),
28
+ srcRow (int64 (6 ), int64 (13 ), float64 (13 ), string ("13" ), nil , [] int64 { 1 , 2 , 3 }, int64 ( 6 ) ),
27
29
),
28
30
),
29
31
SQLTests : []SQLTest {
@@ -221,5 +223,37 @@ var groupByTests = TableTest{
221
223
),
222
224
ExpErr : "aggregate 'MAX()' not allowed in GROUP BY" ,
223
225
},
226
+ {
227
+ SQLs : sqls (
228
+ "SELECT COUNT(*), is1 FROM groupby_test group by is1" ,
229
+ ),
230
+ ExpHdrs : hdrs (
231
+ hdr ("" , fldTypeInt ),
232
+ hdr ("is1" , fldTypeIDSet ),
233
+ ),
234
+ ExpRows : rows (
235
+ row (int64 (5 ), []int64 {1 }),
236
+ row (int64 (4 ), []int64 {2 }),
237
+ row (int64 (4 ), []int64 {3 }),
238
+ ),
239
+ Compare : CompareExactOrdered ,
240
+ },
241
+ {
242
+ SQLs : sqls (
243
+ "SELECT COUNT(*), id1 FROM groupby_test group by id1" ,
244
+ ),
245
+ ExpHdrs : hdrs (
246
+ hdr ("" , fldTypeInt ),
247
+ hdr ("id1" , fldTypeID ),
248
+ ),
249
+ ExpRows : rows (
250
+ row (int64 (2 ), int64 (1 )),
251
+ row (int64 (1 ), int64 (2 )),
252
+ row (int64 (1 ), int64 (3 )),
253
+ row (int64 (1 ), int64 (4 )),
254
+ row (int64 (1 ), int64 (6 )),
255
+ ),
256
+ Compare : CompareExactOrdered ,
257
+ },
224
258
},
225
259
}
0 commit comments