jonahgao commented on code in PR #10547:
URL: https://github.com/apache/datafusion/pull/10547#discussion_r1603518324
##########
datafusion/functions-array/src/extract.rs:
##########
@@ -418,19 +418,16 @@ where
if let (Some(from), Some(to)) = (from_index, to_index) {
let stride = stride.map(|s| s.value(row_index));
- // array_slice with stride in duckdb, return empty array if stride
is not supported and from > to.
- if stride.is_none() && from > to {
- // return empty array
- offsets.push(offsets[row_index]);
- continue;
- }
+ // Default stride is 1 if not provided
let stride = stride.unwrap_or(1);
if stride.is_zero() {
return exec_err!(
"array_slice got invalid stride: {:?}, it cannot be 0",
stride
);
- } else if from <= to && stride.is_negative() {
+ } else if (from <= to && stride.is_negative())
Review Comment:
When `from` is equal to `to`, it should not return an empty list.
The fix for it is not included in this PR, it has been added to issue #10548.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]