array_position
function
Applies to: Databricks SQL Databricks Runtime
Returns the position of the first occurrence of element
in array
.
Syntax
array_position(array, element)
Arguments
array
: An ARRAY with comparable elements.element
: An expression matching the types of the elements inarray
.
Returns
A long type.
Array indexing starts at 1. If the element value is NULL, a NULL is returned.
Examples
> SELECT array_position(array(3, 2, 1, 4, 1), 1);
3
> SELECT array_position(array(3, NULL, 1), NULL)
NULL
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for