Skip to main content
Version: v1.16.0

coalesce

Function

coalesce return first value that is not null, a "missing" error, or a "quiet" error

Synopsis

coalesce(val: any [, ... val: any]) -> bool

Description

The coalesce function returns the first of its arguments that is not null, error("missing"), or error("quiet"). It returns null if all its arguments are null, error("missing"), or error("quiet").

Examples

zq -z 'yield coalesce(null, error("missing"), error("quiet"), 1)'

=>

1
zq -z 'yield coalesce(null, error("missing"), error("quiet"))'

=>

null