Skip to content

Commit

Permalink
bug: Remove array_slice two arg variant (#14527)
Browse files Browse the repository at this point in the history
In 3dfce7d I misunderstood an existing
test and accidentally added a variant of `array_slice` that accepts two
arguments. This variant is not valid and only works if one of the
arguments are null. This commit fixes the problem by removing the two
argument variant.
  • Loading branch information
jkosh44 authored Feb 6, 2025
1 parent b9fba66 commit bab0f54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
5 changes: 0 additions & 5 deletions datafusion/functions-nested/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,6 @@ impl ArraySlice {
Self {
signature: Signature::one_of(
vec![
TypeSignature::ArraySignature(
ArrayFunctionSignature::ArrayAndIndexes(
NonZeroUsize::new(1).expect("1 is non-zero"),
),
),
TypeSignature::ArraySignature(
ArrayFunctionSignature::ArrayAndIndexes(
NonZeroUsize::new(2).expect("2 is non-zero"),
Expand Down
8 changes: 2 additions & 6 deletions datafusion/sqllogictest/test_files/array.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1850,15 +1850,11 @@ select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), 0,
[] []

# array_slice scalar function #11 (with NULL-NULL)
query ??
query error
select array_slice(make_array(1, 2, 3, 4, 5), NULL), array_slice(make_array('h', 'e', 'l', 'l', 'o'), NULL);
----
NULL NULL

query ??
query error
select array_slice(arrow_cast(make_array(1, 2, 3, 4, 5), 'LargeList(Int64)'), NULL), array_slice(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'), NULL);
----
NULL NULL

# array_slice scalar function #12 (with zero and negative number)
query ??
Expand Down

0 comments on commit bab0f54

Please sign in to comment.