First non null value (coalesce)

Supported in: Batch, Streaming

Picks first non null value of the inputs. Known as coalesce in sql.

Expression categories: Data preparation

Declared arguments

  • Expressions - The first non null values of these expressions will be returned.
    List<Expression<T>>
  • optional Treat empty strings as null. - Treat all empty strings as null values.
    Literal<Boolean>

Type variable bounds: T accepts AnyType

Output type: T

Examples

Example 1: Base case

Argument values:

  • Expressions: [tail_number, airline]
  • Treat empty strings as null.: null
tail_numberairlineOutput
XB-123nullXB-123
nullMTMT

Example 2: Base case

Argument values:

  • Expressions: [tail_number, airline]
  • Treat empty strings as null.: true
tail_numberairlineOutput
XB-123nullXB-123
empty stringMTMT

Example 3: Null case

Argument values:

  • Expressions: [tail_number, airline]
  • Treat empty strings as null.: null
tail_numberairlineOutput
nullnullnull