From bab0f54daa99830339c0000a19c1b4e3489278ad Mon Sep 17 00:00:00 2001 From: Joseph Koshakow Date: Thu, 6 Feb 2025 14:35:33 -0500 Subject: [PATCH] bug: Remove array_slice two arg variant (#14527) In 3dfce7d33c19d6e7941b58cb7e83194c066347ca 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. --- datafusion/functions-nested/src/extract.rs | 5 ----- datafusion/sqllogictest/test_files/array.slt | 8 ++------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/datafusion/functions-nested/src/extract.rs b/datafusion/functions-nested/src/extract.rs index 8c120876c38a..b472316d03e1 100644 --- a/datafusion/functions-nested/src/extract.rs +++ b/datafusion/functions-nested/src/extract.rs @@ -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"), diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt index 01aca94a5dd8..8f23bfe5ea65 100644 --- a/datafusion/sqllogictest/test_files/array.slt +++ b/datafusion/sqllogictest/test_files/array.slt @@ -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 ??