coalesce

Description

Return the first non-null argument or null if all are null. All arguments must have the same data type.

Return type

any

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

coalesce( expr ... )

Argument

Type

Required

Multiple

expr

any

Required

Can be multiple

Examples

make_col foo:coalesce(bar, baz, 0)

Create a new column ‘foo’, where for each row, the value of column ‘foo’ is set to the value of column ‘bar’ if it isn’t null, or to the value of column ‘baz’ if it isn’t null, or 0.