Skip to main content
Scalar function
Aliases: filter NULL array returns NULL; NULL elements are passed to the lambda. FALSE and NULL predicates discard the element.

Syntax

Scalar

Filter form (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, ARRAY, MAP or STRUCT.

Scalar, filter form

Returns

  • Type: ARRAY<T>
  • Possible values: Retained input elements.
  • NULL behavior: NULL array returns NULL; NULL elements are passed to the lambda. FALSE and NULL predicates discard the element.
  • Shape: Zero through input number of elements.
  • Ordering: Input encounter order.

Properties

Usage notes

  • The optional lambda index is zero-based.
  • The optional lambda index is BIGINT and starts at 0 for each input array.
  • 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

Filter strings

Limitations

  • The same input gives repeatable results only when the supplied lambda does. Avoid random or other changing expressions when you need reproducible results.
Last modified on October 15, 2026