Nullable(typename)

    For a TypeName, you can’t use composite data types Array and . Composite data types can contain Nullable type values, such as Array(Nullable(Int8)).

    A Nullable type field can’t be included in table indexes.

    To store type values in a table column, ClickHouse uses a separate file with NULL masks in addition to normal file with values. Entries in masks file allow ClickHouse to distinguish between NULL and a default value of corresponding data type for each table row. Because of an additional file, Nullable column consumes additional storage space compared to a similar normal one.

    Note

    It is possible to find NULL values in a column by using null subcolumn without reading the whole column. It returns 1 if the corresponding value is NULL and 0 otherwise.

    Example

    Result:

    1. 1
    2. 0
    3. 1
    4. └────────┘
      1. ┌─plus(x, y)─┐
      2. ᴺᵁᴸᴸ
      3. 5