@@ -1227,6 +1227,11 @@ select array_slice(make_array(1, 2, 3, 4, 5), 1, 5, -1), array_slice(make_array(
1227
1227
query error Execution error: array_slice got invalid stride: 0, it cannot be 0
1228
1228
select array_slice(make_array(1, 2, 3, 4, 5), 1, 5, 0), array_slice(make_array('h', 'e', 'l', 'l', 'o'), 1, 5, 0);
1229
1229
1230
+ query ??
1231
+ select array_slice(make_array(1, 2, 3, 4, 5), 5, 1, -2), array_slice(make_array('h', 'e', 'l', 'l', 'o'), 5, 1, -2);
1232
+ ----
1233
+ [5, 3, 1] [o, l, h]
1234
+
1230
1235
query ??
1231
1236
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), 2, 4), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), 1, 2);
1232
1237
----
@@ -1335,12 +1340,12 @@ select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), NU
1335
1340
query ??
1336
1341
select array_slice(make_array(1, 2, 3, 4, 5), 0, -4), array_slice(make_array('h', 'e', 'l', 'l', 'o'), 0, -3);
1337
1342
----
1338
- [1] [h, e]
1343
+ [1, 2 ] [h, e, l ]
1339
1344
1340
1345
query ??
1341
1346
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), 0, -4), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), 0, -3);
1342
1347
----
1343
- [1] [h, e]
1348
+ [1, 2 ] [h, e, l ]
1344
1349
1345
1350
# array_slice scalar function #13 (with negative number and NULL)
1346
1351
query error
@@ -1360,34 +1365,34 @@ select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), NU
1360
1365
query ??
1361
1366
select array_slice(make_array(1, 2, 3, 4, 5), -4, -1), array_slice(make_array('h', 'e', 'l', 'l', 'o'), -3, -1);
1362
1367
----
1363
- [2, 3, 4] [l, l]
1368
+ [2, 3, 4, 5 ] [l, l, o ]
1364
1369
1365
1370
query ??
1366
1371
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), -4, -1), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), -3, -1);
1367
1372
----
1368
- [2, 3, 4] [l, l]
1373
+ [2, 3, 4, 5 ] [l, l, o ]
1369
1374
1370
1375
# array_slice scalar function #16 (with negative indexes; almost full array (only with negative indices cannot return full array))
1371
1376
query ??
1372
1377
select array_slice(make_array(1, 2, 3, 4, 5), -5, -1), array_slice(make_array('h', 'e', 'l', 'l', 'o'), -5, -1);
1373
1378
----
1374
- [1, 2, 3, 4] [h, e, l, l]
1379
+ [1, 2, 3, 4, 5 ] [h, e, l, l, o ]
1375
1380
1376
1381
query ??
1377
1382
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), -5, -1), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), -5, -1);
1378
1383
----
1379
- [1, 2, 3, 4] [h, e, l, l]
1384
+ [1, 2, 3, 4, 5 ] [h, e, l, l, o ]
1380
1385
1381
1386
# array_slice scalar function #17 (with negative indexes; first index = second index)
1382
1387
query ??
1383
1388
select array_slice(make_array(1, 2, 3, 4, 5), -4, -4), array_slice(make_array('h', 'e', 'l', 'l', 'o'), -3, -3);
1384
1389
----
1385
- [] []
1390
+ [2 ] [l ]
1386
1391
1387
1392
query ??
1388
1393
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), -4, -4), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), -3, -3);
1389
1394
----
1390
- [] []
1395
+ [2 ] [l ]
1391
1396
1392
1397
# array_slice scalar function #18 (with negative indexes; first index > second_index)
1393
1398
query ??
@@ -1415,24 +1420,24 @@ select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), -7
1415
1420
query ??
1416
1421
select array_slice(make_array(make_array(1, 2, 3, 4, 5), make_array(6, 7, 8, 9, 10)), -2, -1), array_slice(make_array(make_array(1, 2, 3), make_array(6, 7, 8)), -1, -1);
1417
1422
----
1418
- [[1, 2, 3, 4, 5]] [ ]
1423
+ [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] [[6, 7, 8] ]
1419
1424
1420
1425
query ??
1421
1426
select array_slice(arrow_cast(make_array(make_array(1, 2, 3, 4, 5), make_array(6, 7, 8, 9, 10)), 'LargeList(List(Int64))'), -2, -1), array_slice(arrow_cast(make_array(make_array(1, 2, 3), make_array(6, 7, 8)), 'LargeList(List(Int64))'), -1, -1);
1422
1427
----
1423
- [[1, 2, 3, 4, 5]] [ ]
1428
+ [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]] [[6, 7, 8] ]
1424
1429
1425
1430
1426
1431
# array_slice scalar function #21 (with first positive index and last negative index)
1427
1432
query ??
1428
1433
select array_slice(make_array(1, 2, 3, 4, 5), 2, -3), array_slice(make_array('h', 'e', 'l', 'l', 'o'), 2, -2);
1429
1434
----
1430
- [2] [e, l]
1435
+ [2, 3 ] [e, l , l]
1431
1436
1432
1437
query ??
1433
1438
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), 2, -3), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), 2, -2);
1434
1439
----
1435
- [2] [e, l]
1440
+ [2, 3 ] [e, l , l]
1436
1441
1437
1442
# array_slice scalar function #22 (with first negative index and last positive index)
1438
1443
query ??
@@ -1461,7 +1466,7 @@ query ?
1461
1466
select array_slice(column1, column2, column3) from slices;
1462
1467
----
1463
1468
[]
1464
- [12, 13, 14, 15, 16]
1469
+ [12, 13, 14, 15, 16, 17 ]
1465
1470
[]
1466
1471
[]
1467
1472
[]
@@ -1472,7 +1477,7 @@ query ?
1472
1477
select array_slice(arrow_cast(column1, 'LargeList(Int64)'), column2, column3) from slices;
1473
1478
----
1474
1479
[]
1475
- [12, 13, 14, 15, 16]
1480
+ [12, 13, 14, 15, 16, 17 ]
1476
1481
[]
1477
1482
[]
1478
1483
[]
@@ -1485,9 +1490,9 @@ query ???
1485
1490
select array_slice(make_array(1, 2, 3, 4, 5), column2, column3), array_slice(column1, 3, column3), array_slice(column1, column2, 5) from slices;
1486
1491
----
1487
1492
[1] [] [, 2, 3, 4, 5]
1488
- [] [13, 14, 15, 16] [12, 13, 14, 15]
1493
+ [2 ] [13, 14, 15, 16, 17 ] [12, 13, 14, 15]
1489
1494
[] [] [21, 22, 23, , 25]
1490
- [] [33] []
1495
+ [] [33, 34 ] []
1491
1496
[4, 5] [] []
1492
1497
[1, 2, 3, 4, 5] [43, 44, 45, 46] [41, 42, 43, 44, 45]
1493
1498
[5] [, 54, 55, 56, 57, 58, 59, 60] [55]
@@ -1496,9 +1501,9 @@ query ???
1496
1501
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), column2, column3), array_slice(arrow_cast(column1, 'LargeList(Int64)'), 3, column3), array_slice(arrow_cast(column1, 'LargeList(Int64)'), column2, 5) from slices;
1497
1502
----
1498
1503
[1] [] [, 2, 3, 4, 5]
1499
- [] [13, 14, 15, 16] [12, 13, 14, 15]
1504
+ [2 ] [13, 14, 15, 16, 17 ] [12, 13, 14, 15]
1500
1505
[] [] [21, 22, 23, , 25]
1501
- [] [33] []
1506
+ [] [33, 34 ] []
1502
1507
[4, 5] [] []
1503
1508
[1, 2, 3, 4, 5] [43, 44, 45, 46] [41, 42, 43, 44, 45]
1504
1509
[5] [, 54, 55, 56, 57, 58, 59, 60] [55]
0 commit comments