map_extract_value()

Returns the value for a given key or NULL if the key is not contained in the map. The type of the key provided in the second parameter must match the type of the map’s keys else an error is returned

Reference: Haybarn WASM 2.0.0-rc12

Arguments & returns

map_extract_value(map, key)

Scalar
Overload link mapkey Returns
#01 MAP(K, V)K V

Look up a map value by key

Read the value associated with a key in a MAP. This returns the value directly, rather than wrapping it in a list.

A missing key returns NULL. A key whose stored value is NULL also returns NULL.

Look up a map value by key
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Guide example · Run to view results.

Expected result
quantitymissing
12NULL

Watch for: Use map_contains() when you must distinguish a missing key from a present key with a NULL value.

Example

map_extract_value example
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Engine example · Run to view results.