Skip to main content
Scalar function
Returns NULL if either array is NULL. NULL map keys raise an error; NULL values are allowed.

Syntax

Scalar

Arguments

Type notation used below:
  • K is the map key type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY or STRUCT.
  • V is the map value type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.

Returns

  • Type: MAP<K,V>
  • Possible values: The paired map entries.
  • NULL behavior: Returns NULL if either array is NULL. NULL map keys raise an error; NULL values are allowed.
  • Shape: One entry per distinct key.
  • Ordering: Map entries are not sorted. Their order follows insertion and duplicate removal.

Properties

Usage notes

  • Duplicate keys raise an error for Databricks source dialect; other dialects use the last value for a repeated key.
  • NaN and signed zero keys are normalized for duplicate comparisons.
  • For last-wins duplicate handling, the retained entries appear in the original order of the surviving last occurrences, without key sorting.
  • 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

Duplicate keys, Databricks dialect

  • Databricks dialect; duplicate-key errors enabled.
Expected error: Duplicate map key

Limitations

  • Arrays of different lengths or arrays containing NULL keys raise an execution error.
Last modified on October 15, 2026