jayzhan211 commented on code in PR #8829:
URL: https://github.com/apache/arrow-datafusion/pull/8829#discussion_r1448748057
##########
datafusion/sqllogictest/test_files/array.slt:
##########
@@ -1214,6 +1214,19 @@ select array_slice(make_array(1, 2, 3, 4, 5), 2, 4),
array_slice(make_array('h',
----
[2, 3, 4] [h, e]
+query ??
+select array_slice(make_array(1, 2, 3, 4, 5), 1, 5, 2),
array_slice(make_array('h', 'e', 'l', 'l', 'o'), 1, 5, 2);
+----
+[1, 3, 5] [h, l, o]
+
+query ??
+select array_slice(make_array(1, 2, 3, 4, 5), 1, 5, -1),
array_slice(make_array('h', 'e', 'l', 'l', 'o'), 1, 5, -1);
+----
+[] []
+
+query error Execution error: array_slice got invalid stride: 0, it cannot be 0
+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);
+
Review Comment:
`SELECT([1, 2, 3, 4, 5])[4:2:-2];` are also needed. And other examples in
duckdb, we should consider them too.
https://duckdb.org/docs/sql/functions/nested#slicing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]