Skip to content

Conversation

@jkosh44
Copy link
Contributor

@jkosh44 jkosh44 commented Feb 6, 2025

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.

Which issue does this PR close?

Related to #10548

Rationale for this change

Fixes a mistake in my previous RP.

Are these changes tested?

Yes

Are there any user-facing changes?

No

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.
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jkosh44

[] []

# array_slice scalar function #11 (with NULL-NULL)
query ??
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is consistent with duckdb too 👍

D select array_slice([1,2,3], null);
Binder Error: No function matches the given name and argument types 'array_slice(INTEGER[], "NULL")'. You might need to add explicit type casts.
	Candidate functions:
	array_slice(ANY, ANY, ANY) -> ANY
	array_slice(ANY, ANY, ANY, BIGINT) -> ANY

LINE 1: select array_slice([1,2,3], null);

@alamb alamb merged commit bab0f54 into apache:main Feb 6, 2025
26 checks passed
@jkosh44 jkosh44 deleted the fix-array-slice-arg-count branch February 6, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants