@@ -893,7 +893,7 @@ func TestArrayAndMetadataAsArray(t *testing.T) {
893
893
},
894
894
{
895
895
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 " ,
897
897
expected1 : []float64 {1.1 , 2.2 },
898
898
expected2 : []float64 {3.3 },
899
899
actual : []float64 {},
@@ -1028,7 +1028,7 @@ func TestEmptyArraysAndNullArrays(t *testing.T) {
1028
1028
ctx := WithStructuredTypesEnabled (context .Background ())
1029
1029
runDBTest (t , func (dbt * DBTest ) {
1030
1030
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 " )
1032
1032
defer rows .Close ()
1033
1033
checkRow := func (rows * RowsExtended , expected * []int64 ) {
1034
1034
var res * []int64
@@ -1038,10 +1038,10 @@ func TestEmptyArraysAndNullArrays(t *testing.T) {
1038
1038
assertDeepEqualE (t , res , expected )
1039
1039
}
1040
1040
1041
- checkRow (rows , & []int64 {1 , 2 })
1042
1041
checkRow (rows , & []int64 {})
1043
- checkRow (rows , nil )
1042
+ checkRow (rows , & [] int64 { 1 , 2 } )
1044
1043
checkRow (rows , & []int64 {4 , 5 , 6 })
1044
+ checkRow (rows , nil )
1045
1045
})
1046
1046
})
1047
1047
}
@@ -1236,168 +1236,168 @@ func TestMapAndMetadataAsMap(t *testing.T) {
1236
1236
}{
1237
1237
{
1238
1238
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 " ,
1240
1240
expected1 : map [string ]string {"a" : "x" , "b" : "y" },
1241
1241
expected2 : map [string ]string {"c" : "z" },
1242
1242
actual : make (map [string ]string ),
1243
1243
},
1244
1244
{
1245
1245
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 " ,
1247
1247
expected1 : map [int64 ]string {int64 (1 ): "x" , int64 (2 ): "y" },
1248
1248
expected2 : map [int64 ]string {int64 (3 ): "z" },
1249
1249
actual : make (map [int64 ]string ),
1250
1250
},
1251
1251
{
1252
1252
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 " ,
1254
1254
expected1 : map [string ]bool {"a" : true , "b" : false },
1255
1255
expected2 : map [string ]bool {"c" : true },
1256
1256
actual : make (map [string ]bool ),
1257
1257
},
1258
1258
{
1259
1259
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 " ,
1261
1261
expected1 : map [int64 ]bool {int64 (1 ): true , int64 (2 ): false },
1262
1262
expected2 : map [int64 ]bool {int64 (3 ): true },
1263
1263
actual : make (map [int64 ]bool ),
1264
1264
},
1265
1265
{
1266
1266
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 " ,
1268
1268
expected1 : map [string ]int64 {"a" : 11 , "b" : 22 },
1269
1269
expected2 : map [string ]int64 {"c" : 33 },
1270
1270
actual : make (map [string ]int64 ),
1271
1271
},
1272
1272
{
1273
1273
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 " ,
1275
1275
expected1 : map [int64 ]int64 {int64 (1 ): int64 (11 ), int64 (2 ): int64 (22 )},
1276
1276
expected2 : map [int64 ]int64 {int64 (3 ): int64 (33 )},
1277
1277
actual : make (map [int64 ]int64 ),
1278
1278
},
1279
1279
{
1280
1280
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 " ,
1282
1282
expected1 : map [string ]float64 {"a" : 11.1 , "b" : 22.2 },
1283
1283
expected2 : map [string ]float64 {"c" : 33.3 },
1284
1284
actual : make (map [string ]float64 ),
1285
1285
},
1286
1286
{
1287
1287
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 " ,
1289
1289
expected1 : map [int64 ]float64 {int64 (1 ): 11.1 , int64 (2 ): 22.2 },
1290
1290
expected2 : map [int64 ]float64 {int64 (3 ): 33.3 },
1291
1291
actual : make (map [int64 ]float64 ),
1292
1292
},
1293
1293
{
1294
1294
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 " ,
1296
1296
expected1 : map [string ]int64 {"a" : 11 , "b" : 22 },
1297
1297
expected2 : map [string ]int64 {"c" : 33 },
1298
1298
actual : make (map [string ]int64 ),
1299
1299
},
1300
1300
{
1301
1301
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 " ,
1303
1303
expected1 : map [int64 ]int64 {int64 (1 ): int64 (11 ), int64 (2 ): int64 (22 )},
1304
1304
expected2 : map [int64 ]int64 {int64 (3 ): int64 (33 )},
1305
1305
actual : make (map [int64 ]int64 ),
1306
1306
},
1307
1307
{
1308
1308
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 " ,
1310
1310
expected1 : map [string ]float64 {"a" : 11.1 , "b" : 22.2 },
1311
1311
expected2 : map [string ]float64 {"c" : 33.3 },
1312
1312
actual : make (map [string ]float64 ),
1313
1313
},
1314
1314
{
1315
1315
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 " ,
1317
1317
expected1 : map [int64 ]float64 {int64 (1 ): 11.1 , int64 (2 ): 22.2 },
1318
1318
expected2 : map [int64 ]float64 {int64 (3 ): 33.3 },
1319
1319
actual : make (map [int64 ]float64 ),
1320
1320
},
1321
1321
{
1322
1322
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 " ,
1324
1324
expected1 : map [string ][]byte {"a" : {'a' , 'b' , 'c' }, "b" : {'d' , 'e' , 'f' }},
1325
1325
expected2 : map [string ][]byte {"c" : {'g' , 'h' , 'i' }},
1326
1326
actual : make (map [string ][]byte ),
1327
1327
},
1328
1328
{
1329
1329
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 " ,
1331
1331
expected1 : map [int64 ][]byte {1 : {'a' , 'b' , 'c' }, 2 : {'d' , 'e' , 'f' }},
1332
1332
expected2 : map [int64 ][]byte {3 : {'g' , 'h' , 'i' }},
1333
1333
actual : make (map [int64 ][]byte ),
1334
1334
},
1335
1335
{
1336
1336
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 " ,
1338
1338
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 )},
1339
1339
expected2 : map [string ]time.Time {"c" : time .Date (2024 , time .April , 4 , 0 , 0 , 0 , 0 , time .UTC )},
1340
1340
actual : make (map [string ]time.Time ),
1341
1341
},
1342
1342
{
1343
1343
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 " ,
1345
1345
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 )},
1346
1346
expected2 : map [int64 ]time.Time {3 : time .Date (2024 , time .April , 4 , 0 , 0 , 0 , 0 , time .UTC )},
1347
1347
actual : make (map [int64 ]time.Time ),
1348
1348
},
1349
1349
{
1350
1350
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 " ,
1352
1352
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 )},
1353
1353
expected2 : map [string ]time.Time {"c" : time .Date (0 , 0 , 0 , 13 , 3 , 4 , 0 , time .UTC )},
1354
1354
actual : make (map [string ]time.Time ),
1355
1355
},
1356
1356
{
1357
1357
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 " ,
1359
1359
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 )},
1360
1360
expected2 : map [string ]time.Time {"3" : time .Date (0 , 0 , 0 , 13 , 3 , 4 , 0 , time .UTC )},
1361
1361
actual : make (map [int64 ]time.Time ),
1362
1362
},
1363
1363
{
1364
1364
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 " ,
1366
1366
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 )},
1367
1367
expected2 : map [string ]time.Time {"c" : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , time .UTC )},
1368
1368
actual : make (map [string ]time.Time ),
1369
1369
},
1370
1370
{
1371
1371
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 " ,
1373
1373
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 )},
1374
1374
expected2 : map [int64 ]time.Time {3 : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , time .UTC )},
1375
1375
actual : make (map [int64 ]time.Time ),
1376
1376
},
1377
1377
{
1378
1378
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 " ,
1380
1380
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 )},
1381
1381
expected2 : map [string ]time.Time {"c" : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , warsawTz )},
1382
1382
actual : make (map [string ]time.Time ),
1383
1383
},
1384
1384
{
1385
1385
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 " ,
1387
1387
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 )},
1388
1388
expected2 : map [int64 ]time.Time {3 : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , time .UTC )},
1389
1389
actual : make (map [int64 ]time.Time ),
1390
1390
},
1391
1391
{
1392
1392
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 " ,
1394
1394
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 )},
1395
1395
expected2 : map [string ]time.Time {"c" : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , warsawTz )},
1396
1396
actual : make (map [string ]time.Time ),
1397
1397
},
1398
1398
{
1399
1399
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 " ,
1401
1401
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 )},
1402
1402
expected2 : map [int64 ]time.Time {3 : time .Date (2024 , time .January , 7 , 11 , 22 , 33 , 0 , time .UTC )},
1403
1403
actual : make (map [int64 ]time.Time ),
@@ -1580,7 +1580,7 @@ func TestNullAndEmptyMaps(t *testing.T) {
1580
1580
ctx := WithStructuredTypesEnabled (context .Background ())
1581
1581
runDBTest (t , func (dbt * DBTest ) {
1582
1582
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 " )
1584
1584
defer rows .Close ()
1585
1585
checkRow := func (rows * RowsExtended , expected * map [string ]int64 ) {
1586
1586
rows .Next ()
@@ -1589,10 +1589,10 @@ func TestNullAndEmptyMaps(t *testing.T) {
1589
1589
assertNilF (t , err )
1590
1590
assertDeepEqualE (t , res , expected )
1591
1591
}
1592
- checkRow (rows , & map [string ]int64 {"a" : 1 })
1593
- checkRow (rows , nil )
1594
1592
checkRow (rows , & map [string ]int64 {})
1595
1593
checkRow (rows , & map [string ]int64 {"d" : 4 })
1594
+ checkRow (rows , & map [string ]int64 {"a" : 1 })
1595
+ checkRow (rows , nil )
1596
1596
})
1597
1597
})
1598
1598
}
0 commit comments