Skip to main content
Scalar function
Returns NULL for a NULL array or search element.

Syntax

Scalar

Arguments

Type notation used below:
  • T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP or ARRAY.

Returns

  • Type: unsigned 64-bit integer; query tools may report INTEGER
  • Possible values: A 1-based position, or zero when not found.
  • NULL behavior: Returns NULL for a NULL array or search element.

Properties

Usage notes

  • INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

Examples

Typical behavior

Find a string and a missing value

Limitations

  • The position is returned as an unsigned 64-bit integer, even when query tools report INTEGER.
  • Scalar elements and nested arrays are supported. MAP and STRUCT elements are not supported.
Last modified on October 15, 2026