Skip to content

Commit 220e36e

Browse files
authored
NO-SNOW Fix tests which were lacking order by clause (#1290)
1 parent dda273b commit 220e36e

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

structured_type_read_test.go

+31-31
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ func TestArrayAndMetadataAsArray(t *testing.T) {
893893
},
894894
{
895895
name: "double",
896-
query: "SELECT ARRAY_CONSTRUCT(1.1, 2.2)::ARRAY(DOUBLE) as structured_type UNION SELECT ARRAY_CONSTRUCT(3.3)::ARRAY(DOUBLE)",
896+
query: "SELECT ARRAY_CONSTRUCT(1.1, 2.2)::ARRAY(DOUBLE) as structured_type UNION SELECT ARRAY_CONSTRUCT(3.3)::ARRAY(DOUBLE) ORDER BY 1",
897897
expected1: []float64{1.1, 2.2},
898898
expected2: []float64{3.3},
899899
actual: []float64{},
@@ -1028,7 +1028,7 @@ func TestEmptyArraysAndNullArrays(t *testing.T) {
10281028
ctx := WithStructuredTypesEnabled(context.Background())
10291029
runDBTest(t, func(dbt *DBTest) {
10301030
forAllStructureTypeFormats(dbt, func(t *testing.T, format string) {
1031-
rows := dbt.mustQueryContextT(ctx, t, "SELECT ARRAY_CONSTRUCT(1, 2)::ARRAY(INTEGER) as structured_type UNION SELECT ARRAY_CONSTRUCT()::ARRAY(INTEGER) UNION SELECT NULL UNION SELECT ARRAY_CONSTRUCT(4, 5, 6)::ARRAY(INTEGER)")
1031+
rows := dbt.mustQueryContextT(ctx, t, "SELECT ARRAY_CONSTRUCT(1, 2)::ARRAY(INTEGER) as structured_type UNION SELECT ARRAY_CONSTRUCT()::ARRAY(INTEGER) UNION SELECT NULL UNION SELECT ARRAY_CONSTRUCT(4, 5, 6)::ARRAY(INTEGER) ORDER BY 1")
10321032
defer rows.Close()
10331033
checkRow := func(rows *RowsExtended, expected *[]int64) {
10341034
var res *[]int64
@@ -1038,10 +1038,10 @@ func TestEmptyArraysAndNullArrays(t *testing.T) {
10381038
assertDeepEqualE(t, res, expected)
10391039
}
10401040

1041-
checkRow(rows, &[]int64{1, 2})
10421041
checkRow(rows, &[]int64{})
1043-
checkRow(rows, nil)
1042+
checkRow(rows, &[]int64{1, 2})
10441043
checkRow(rows, &[]int64{4, 5, 6})
1044+
checkRow(rows, nil)
10451045
})
10461046
})
10471047
}
@@ -1236,168 +1236,168 @@ func TestMapAndMetadataAsMap(t *testing.T) {
12361236
}{
12371237
{
12381238
name: "string string",
1239-
query: "SELECT {'a': 'x', 'b': 'y'}::MAP(VARCHAR, VARCHAR) as structured_type UNION SELECT {'c': 'z'}::MAP(VARCHAR, VARCHAR)",
1239+
query: "SELECT {'a': 'x', 'b': 'y'}::MAP(VARCHAR, VARCHAR) as structured_type UNION SELECT {'c': 'z'}::MAP(VARCHAR, VARCHAR) ORDER BY 1 DESC",
12401240
expected1: map[string]string{"a": "x", "b": "y"},
12411241
expected2: map[string]string{"c": "z"},
12421242
actual: make(map[string]string),
12431243
},
12441244
{
12451245
name: "integer string",
1246-
query: "SELECT {'1': 'x', '2': 'y'}::MAP(INTEGER, VARCHAR) as structured_type UNION SELECT {'3': 'z'}::MAP(INTEGER, VARCHAR)",
1246+
query: "SELECT {'1': 'x', '2': 'y'}::MAP(INTEGER, VARCHAR) as structured_type UNION SELECT {'3': 'z'}::MAP(INTEGER, VARCHAR) ORDER BY 1 DESC",
12471247
expected1: map[int64]string{int64(1): "x", int64(2): "y"},
12481248
expected2: map[int64]string{int64(3): "z"},
12491249
actual: make(map[int64]string),
12501250
},
12511251
{
12521252
name: "string bool",
1253-
query: "SELECT {'a': true, 'b': false}::MAP(VARCHAR, BOOLEAN) as structured_type UNION SELECT {'c': true}::MAP(VARCHAR, BOOLEAN)",
1253+
query: "SELECT {'a': true, 'b': false}::MAP(VARCHAR, BOOLEAN) as structured_type UNION SELECT {'c': true}::MAP(VARCHAR, BOOLEAN) ORDER BY 1 DESC",
12541254
expected1: map[string]bool{"a": true, "b": false},
12551255
expected2: map[string]bool{"c": true},
12561256
actual: make(map[string]bool),
12571257
},
12581258
{
12591259
name: "integer bool",
1260-
query: "SELECT {'1': true, '2': false}::MAP(INTEGER, BOOLEAN) as structured_type UNION SELECT {'3': true}::MAP(INTEGER, BOOLEAN)",
1260+
query: "SELECT {'1': true, '2': false}::MAP(INTEGER, BOOLEAN) as structured_type UNION SELECT {'3': true}::MAP(INTEGER, BOOLEAN) ORDER BY 1 DESC",
12611261
expected1: map[int64]bool{int64(1): true, int64(2): false},
12621262
expected2: map[int64]bool{int64(3): true},
12631263
actual: make(map[int64]bool),
12641264
},
12651265
{
12661266
name: "string integer",
1267-
query: "SELECT {'a': 11, 'b': 22}::MAP(VARCHAR, INTEGER) as structured_type UNION SELECT {'c': 33}::MAP(VARCHAR, INTEGER)",
1267+
query: "SELECT {'a': 11, 'b': 22}::MAP(VARCHAR, INTEGER) as structured_type UNION SELECT {'c': 33}::MAP(VARCHAR, INTEGER) ORDER BY 1 DESC",
12681268
expected1: map[string]int64{"a": 11, "b": 22},
12691269
expected2: map[string]int64{"c": 33},
12701270
actual: make(map[string]int64),
12711271
},
12721272
{
12731273
name: "integer integer",
1274-
query: "SELECT {'1': 11, '2': 22}::MAP(INTEGER, INTEGER) as structured_type UNION SELECT {'3': 33}::MAP(INTEGER, INTEGER)",
1274+
query: "SELECT {'1': 11, '2': 22}::MAP(INTEGER, INTEGER) as structured_type UNION SELECT {'3': 33}::MAP(INTEGER, INTEGER) ORDER BY 1 DESC",
12751275
expected1: map[int64]int64{int64(1): int64(11), int64(2): int64(22)},
12761276
expected2: map[int64]int64{int64(3): int64(33)},
12771277
actual: make(map[int64]int64),
12781278
},
12791279
{
12801280
name: "string double",
1281-
query: "SELECT {'a': 11.1, 'b': 22.2}::MAP(VARCHAR, DOUBLE) as structured_type UNION SELECT {'c': 33.3}::MAP(VARCHAR, DOUBLE)",
1281+
query: "SELECT {'a': 11.1, 'b': 22.2}::MAP(VARCHAR, DOUBLE) as structured_type UNION SELECT {'c': 33.3}::MAP(VARCHAR, DOUBLE) ORDER BY 1 DESC",
12821282
expected1: map[string]float64{"a": 11.1, "b": 22.2},
12831283
expected2: map[string]float64{"c": 33.3},
12841284
actual: make(map[string]float64),
12851285
},
12861286
{
12871287
name: "integer double",
1288-
query: "SELECT {'1': 11.1, '2': 22.2}::MAP(INTEGER, DOUBLE) as structured_type UNION SELECT {'3': 33.3}::MAP(INTEGER, DOUBLE)",
1288+
query: "SELECT {'1': 11.1, '2': 22.2}::MAP(INTEGER, DOUBLE) as structured_type UNION SELECT {'3': 33.3}::MAP(INTEGER, DOUBLE) ORDER BY 1 DESC",
12891289
expected1: map[int64]float64{int64(1): 11.1, int64(2): 22.2},
12901290
expected2: map[int64]float64{int64(3): 33.3},
12911291
actual: make(map[int64]float64),
12921292
},
12931293
{
12941294
name: "string number integer",
1295-
query: "SELECT {'a': 11, 'b': 22}::MAP(VARCHAR, NUMBER(38, 0)) as structured_type UNION SELECT {'c': 33}::MAP(VARCHAR, NUMBER(38, 0))",
1295+
query: "SELECT {'a': 11, 'b': 22}::MAP(VARCHAR, NUMBER(38, 0)) as structured_type UNION SELECT {'c': 33}::MAP(VARCHAR, NUMBER(38, 0)) ORDER BY 1 DESC",
12961296
expected1: map[string]int64{"a": 11, "b": 22},
12971297
expected2: map[string]int64{"c": 33},
12981298
actual: make(map[string]int64),
12991299
},
13001300
{
13011301
name: "integer number integer",
1302-
query: "SELECT {'1': 11, '2': 22}::MAP(INTEGER, NUMBER(38, 0)) as structured_type UNION SELECT {'3': 33}::MAP(INTEGER, NUMBER(38, 0))",
1302+
query: "SELECT {'1': 11, '2': 22}::MAP(INTEGER, NUMBER(38, 0)) as structured_type UNION SELECT {'3': 33}::MAP(INTEGER, NUMBER(38, 0)) ORDER BY 1 DESC",
13031303
expected1: map[int64]int64{int64(1): int64(11), int64(2): int64(22)},
13041304
expected2: map[int64]int64{int64(3): int64(33)},
13051305
actual: make(map[int64]int64),
13061306
},
13071307
{
13081308
name: "string number fraction",
1309-
query: "SELECT {'a': 11.1, 'b': 22.2}::MAP(VARCHAR, NUMBER(38, 19)) as structured_type UNION SELECT {'c': 33.3}::MAP(VARCHAR, NUMBER(38, 19))",
1309+
query: "SELECT {'a': 11.1, 'b': 22.2}::MAP(VARCHAR, NUMBER(38, 19)) as structured_type UNION SELECT {'c': 33.3}::MAP(VARCHAR, NUMBER(38, 19)) ORDER BY 1 DESC",
13101310
expected1: map[string]float64{"a": 11.1, "b": 22.2},
13111311
expected2: map[string]float64{"c": 33.3},
13121312
actual: make(map[string]float64),
13131313
},
13141314
{
13151315
name: "integer number fraction",
1316-
query: "SELECT {'1': 11.1, '2': 22.2}::MAP(INTEGER, NUMBER(38, 19)) as structured_type UNION SELECT {'3': 33.3}::MAP(INTEGER, NUMBER(38, 19))",
1316+
query: "SELECT {'1': 11.1, '2': 22.2}::MAP(INTEGER, NUMBER(38, 19)) as structured_type UNION SELECT {'3': 33.3}::MAP(INTEGER, NUMBER(38, 19)) ORDER BY 1 DESC",
13171317
expected1: map[int64]float64{int64(1): 11.1, int64(2): 22.2},
13181318
expected2: map[int64]float64{int64(3): 33.3},
13191319
actual: make(map[int64]float64),
13201320
},
13211321
{
13221322
name: "string binary",
1323-
query: "SELECT {'a': TO_BINARY('616263', 'HEX'), 'b': TO_BINARY('646566', 'HEX')}::MAP(VARCHAR, BINARY) as structured_type UNION SELECT {'c': TO_BINARY('676869', 'HEX')}::MAP(VARCHAR, BINARY)",
1323+
query: "SELECT {'a': TO_BINARY('616263', 'HEX'), 'b': TO_BINARY('646566', 'HEX')}::MAP(VARCHAR, BINARY) as structured_type UNION SELECT {'c': TO_BINARY('676869', 'HEX')}::MAP(VARCHAR, BINARY) ORDER BY 1 DESC",
13241324
expected1: map[string][]byte{"a": {'a', 'b', 'c'}, "b": {'d', 'e', 'f'}},
13251325
expected2: map[string][]byte{"c": {'g', 'h', 'i'}},
13261326
actual: make(map[string][]byte),
13271327
},
13281328
{
13291329
name: "integer binary",
1330-
query: "SELECT {'1': TO_BINARY('616263', 'HEX'), '2': TO_BINARY('646566', 'HEX')}::MAP(INTEGER, BINARY) as structured_type UNION SELECT {'3': TO_BINARY('676869', 'HEX')}::MAP(INTEGER, BINARY)",
1330+
query: "SELECT {'1': TO_BINARY('616263', 'HEX'), '2': TO_BINARY('646566', 'HEX')}::MAP(INTEGER, BINARY) as structured_type UNION SELECT {'3': TO_BINARY('676869', 'HEX')}::MAP(INTEGER, BINARY) ORDER BY 1 DESC",
13311331
expected1: map[int64][]byte{1: {'a', 'b', 'c'}, 2: {'d', 'e', 'f'}},
13321332
expected2: map[int64][]byte{3: {'g', 'h', 'i'}},
13331333
actual: make(map[int64][]byte),
13341334
},
13351335
{
13361336
name: "string date",
1337-
query: "SELECT {'a': '2024-04-02'::DATE, 'b': '2024-04-03'::DATE}::MAP(VARCHAR, DATE) as structured_type UNION SELECT {'c': '2024-04-04'::DATE}::MAP(VARCHAR, DATE)",
1337+
query: "SELECT {'a': '2024-04-02'::DATE, 'b': '2024-04-03'::DATE}::MAP(VARCHAR, DATE) as structured_type UNION SELECT {'c': '2024-04-04'::DATE}::MAP(VARCHAR, DATE) ORDER BY 1 DESC",
13381338
expected1: map[string]time.Time{"a": time.Date(2024, time.April, 2, 0, 0, 0, 0, time.UTC), "b": time.Date(2024, time.April, 3, 0, 0, 0, 0, time.UTC)},
13391339
expected2: map[string]time.Time{"c": time.Date(2024, time.April, 4, 0, 0, 0, 0, time.UTC)},
13401340
actual: make(map[string]time.Time),
13411341
},
13421342
{
13431343
name: "integer date",
1344-
query: "SELECT {'1': '2024-04-02'::DATE, '2': '2024-04-03'::DATE}::MAP(INTEGER, DATE) as structured_type UNION SELECT {'3': '2024-04-04'::DATE}::MAP(INTEGER, DATE)",
1344+
query: "SELECT {'1': '2024-04-02'::DATE, '2': '2024-04-03'::DATE}::MAP(INTEGER, DATE) as structured_type UNION SELECT {'3': '2024-04-04'::DATE}::MAP(INTEGER, DATE) ORDER BY 1 DESC",
13451345
expected1: map[int64]time.Time{1: time.Date(2024, time.April, 2, 0, 0, 0, 0, time.UTC), 2: time.Date(2024, time.April, 3, 0, 0, 0, 0, time.UTC)},
13461346
expected2: map[int64]time.Time{3: time.Date(2024, time.April, 4, 0, 0, 0, 0, time.UTC)},
13471347
actual: make(map[int64]time.Time),
13481348
},
13491349
{
13501350
name: "string time",
1351-
query: "SELECT {'a': '13:03:02'::TIME, 'b': '13:03:03'::TIME}::MAP(VARCHAR, TIME) as structured_type UNION SELECT {'c': '13:03:04'::TIME}::MAP(VARCHAR, TIME)",
1351+
query: "SELECT {'a': '13:03:02'::TIME, 'b': '13:03:03'::TIME}::MAP(VARCHAR, TIME) as structured_type UNION SELECT {'c': '13:03:04'::TIME}::MAP(VARCHAR, TIME) ORDER BY 1 DESC",
13521352
expected1: map[string]time.Time{"a": time.Date(0, 0, 0, 13, 3, 2, 0, time.UTC), "b": time.Date(0, 0, 0, 13, 3, 3, 0, time.UTC)},
13531353
expected2: map[string]time.Time{"c": time.Date(0, 0, 0, 13, 3, 4, 0, time.UTC)},
13541354
actual: make(map[string]time.Time),
13551355
},
13561356
{
13571357
name: "integer time",
1358-
query: "SELECT {'1': '13:03:02'::TIME, '2': '13:03:03'::TIME}::MAP(VARCHAR, TIME) as structured_type UNION SELECT {'3': '13:03:04'::TIME}::MAP(VARCHAR, TIME)",
1358+
query: "SELECT {'1': '13:03:02'::TIME, '2': '13:03:03'::TIME}::MAP(VARCHAR, TIME) as structured_type UNION SELECT {'3': '13:03:04'::TIME}::MAP(VARCHAR, TIME) ORDER BY 1 DESC",
13591359
expected1: map[string]time.Time{"1": time.Date(0, 0, 0, 13, 3, 2, 0, time.UTC), "2": time.Date(0, 0, 0, 13, 3, 3, 0, time.UTC)},
13601360
expected2: map[string]time.Time{"3": time.Date(0, 0, 0, 13, 3, 4, 0, time.UTC)},
13611361
actual: make(map[int64]time.Time),
13621362
},
13631363
{
13641364
name: "string timestamp_ntz",
1365-
query: "SELECT {'a': '2024-01-05 11:22:33'::TIMESTAMP_NTZ, 'b': '2024-01-06 11:22:33'::TIMESTAMP_NTZ}::MAP(VARCHAR, TIMESTAMP_NTZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33'::TIMESTAMP_NTZ}::MAP(VARCHAR, TIMESTAMP_NTZ)",
1365+
query: "SELECT {'a': '2024-01-05 11:22:33'::TIMESTAMP_NTZ, 'b': '2024-01-06 11:22:33'::TIMESTAMP_NTZ}::MAP(VARCHAR, TIMESTAMP_NTZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33'::TIMESTAMP_NTZ}::MAP(VARCHAR, TIMESTAMP_NTZ) ORDER BY 1 DESC",
13661366
expected1: map[string]time.Time{"a": time.Date(2024, time.January, 5, 11, 22, 33, 0, time.UTC), "b": time.Date(2024, time.January, 6, 11, 22, 33, 0, time.UTC)},
13671367
expected2: map[string]time.Time{"c": time.Date(2024, time.January, 7, 11, 22, 33, 0, time.UTC)},
13681368
actual: make(map[string]time.Time),
13691369
},
13701370
{
13711371
name: "integer timestamp_ntz",
1372-
query: "SELECT {'1': '2024-01-05 11:22:33'::TIMESTAMP_NTZ, '2': '2024-01-06 11:22:33'::TIMESTAMP_NTZ}::MAP(INTEGER, TIMESTAMP_NTZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33'::TIMESTAMP_NTZ}::MAP(INTEGER, TIMESTAMP_NTZ)",
1372+
query: "SELECT {'1': '2024-01-05 11:22:33'::TIMESTAMP_NTZ, '2': '2024-01-06 11:22:33'::TIMESTAMP_NTZ}::MAP(INTEGER, TIMESTAMP_NTZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33'::TIMESTAMP_NTZ}::MAP(INTEGER, TIMESTAMP_NTZ) ORDER BY 1 DESC",
13731373
expected1: map[int64]time.Time{1: time.Date(2024, time.January, 5, 11, 22, 33, 0, time.UTC), 2: time.Date(2024, time.January, 6, 11, 22, 33, 0, time.UTC)},
13741374
expected2: map[int64]time.Time{3: time.Date(2024, time.January, 7, 11, 22, 33, 0, time.UTC)},
13751375
actual: make(map[int64]time.Time),
13761376
},
13771377
{
13781378
name: "string timestamp_tz",
1379-
query: "SELECT {'a': '2024-01-05 11:22:33 +0100'::TIMESTAMP_TZ, 'b': '2024-01-06 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(VARCHAR, TIMESTAMP_TZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(VARCHAR, TIMESTAMP_TZ)",
1379+
query: "SELECT {'a': '2024-01-05 11:22:33 +0100'::TIMESTAMP_TZ, 'b': '2024-01-06 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(VARCHAR, TIMESTAMP_TZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(VARCHAR, TIMESTAMP_TZ) ORDER BY 1 DESC",
13801380
expected1: map[string]time.Time{"a": time.Date(2024, time.January, 5, 11, 22, 33, 0, warsawTz), "b": time.Date(2024, time.January, 6, 11, 22, 33, 0, warsawTz)},
13811381
expected2: map[string]time.Time{"c": time.Date(2024, time.January, 7, 11, 22, 33, 0, warsawTz)},
13821382
actual: make(map[string]time.Time),
13831383
},
13841384
{
13851385
name: "integer timestamp_tz",
1386-
query: "SELECT {'1': '2024-01-05 11:22:33 +0100'::TIMESTAMP_TZ, '2': '2024-01-06 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(INTEGER, TIMESTAMP_TZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(INTEGER, TIMESTAMP_TZ)",
1386+
query: "SELECT {'1': '2024-01-05 11:22:33 +0100'::TIMESTAMP_TZ, '2': '2024-01-06 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(INTEGER, TIMESTAMP_TZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33 +0100'::TIMESTAMP_TZ}::MAP(INTEGER, TIMESTAMP_TZ) ORDER BY 1 DESC",
13871387
expected1: map[int64]time.Time{1: time.Date(2024, time.January, 5, 11, 22, 33, 0, time.UTC), 2: time.Date(2024, time.January, 6, 11, 22, 33, 0, time.UTC)},
13881388
expected2: map[int64]time.Time{3: time.Date(2024, time.January, 7, 11, 22, 33, 0, time.UTC)},
13891389
actual: make(map[int64]time.Time),
13901390
},
13911391
{
13921392
name: "string timestamp_ltz",
1393-
query: "SELECT {'a': '2024-01-05 11:22:33'::TIMESTAMP_LTZ, 'b': '2024-01-06 11:22:33'::TIMESTAMP_LTZ}::MAP(VARCHAR, TIMESTAMP_LTZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33'::TIMESTAMP_LTZ}::MAP(VARCHAR, TIMESTAMP_LTZ)",
1393+
query: "SELECT {'a': '2024-01-05 11:22:33'::TIMESTAMP_LTZ, 'b': '2024-01-06 11:22:33'::TIMESTAMP_LTZ}::MAP(VARCHAR, TIMESTAMP_LTZ) as structured_type UNION SELECT {'c': '2024-01-07 11:22:33'::TIMESTAMP_LTZ}::MAP(VARCHAR, TIMESTAMP_LTZ) ORDER BY 1 DESC",
13941394
expected1: map[string]time.Time{"a": time.Date(2024, time.January, 5, 11, 22, 33, 0, warsawTz), "b": time.Date(2024, time.January, 6, 11, 22, 33, 0, warsawTz)},
13951395
expected2: map[string]time.Time{"c": time.Date(2024, time.January, 7, 11, 22, 33, 0, warsawTz)},
13961396
actual: make(map[string]time.Time),
13971397
},
13981398
{
13991399
name: "integer timestamp_ltz",
1400-
query: "SELECT {'1': '2024-01-05 11:22:33'::TIMESTAMP_LTZ, '2': '2024-01-06 11:22:33'::TIMESTAMP_LTZ}::MAP(INTEGER, TIMESTAMP_LTZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33'::TIMESTAMP_LTZ}::MAP(INTEGER, TIMESTAMP_LTZ)",
1400+
query: "SELECT {'1': '2024-01-05 11:22:33'::TIMESTAMP_LTZ, '2': '2024-01-06 11:22:33'::TIMESTAMP_LTZ}::MAP(INTEGER, TIMESTAMP_LTZ) as structured_type UNION SELECT {'3': '2024-01-07 11:22:33'::TIMESTAMP_LTZ}::MAP(INTEGER, TIMESTAMP_LTZ) ORDER BY 1 DESC",
14011401
expected1: map[int64]time.Time{1: time.Date(2024, time.January, 5, 11, 22, 33, 0, time.UTC), 2: time.Date(2024, time.January, 6, 11, 22, 33, 0, time.UTC)},
14021402
expected2: map[int64]time.Time{3: time.Date(2024, time.January, 7, 11, 22, 33, 0, time.UTC)},
14031403
actual: make(map[int64]time.Time),
@@ -1580,7 +1580,7 @@ func TestNullAndEmptyMaps(t *testing.T) {
15801580
ctx := WithStructuredTypesEnabled(context.Background())
15811581
runDBTest(t, func(dbt *DBTest) {
15821582
forAllStructureTypeFormats(dbt, func(t *testing.T, format string) {
1583-
rows := dbt.mustQueryContextT(ctx, t, "SELECT {'a': 1}::MAP(VARCHAR, INTEGER) UNION SELECT NULL UNION SELECT {}::MAP(VARCHAR, INTEGER) UNION SELECT {'d': 4}::MAP(VARCHAR, INTEGER)")
1583+
rows := dbt.mustQueryContextT(ctx, t, "SELECT {'a': 1}::MAP(VARCHAR, INTEGER) UNION SELECT NULL UNION SELECT {}::MAP(VARCHAR, INTEGER) UNION SELECT {'d': 4}::MAP(VARCHAR, INTEGER) ORDER BY 1")
15841584
defer rows.Close()
15851585
checkRow := func(rows *RowsExtended, expected *map[string]int64) {
15861586
rows.Next()
@@ -1589,10 +1589,10 @@ func TestNullAndEmptyMaps(t *testing.T) {
15891589
assertNilF(t, err)
15901590
assertDeepEqualE(t, res, expected)
15911591
}
1592-
checkRow(rows, &map[string]int64{"a": 1})
1593-
checkRow(rows, nil)
15941592
checkRow(rows, &map[string]int64{})
15951593
checkRow(rows, &map[string]int64{"d": 4})
1594+
checkRow(rows, &map[string]int64{"a": 1})
1595+
checkRow(rows, nil)
15961596
})
15971597
})
15981598
}

0 commit comments

Comments
 (0)