{ “title”: “NON_NULLABLE”, “language”: “en” }

non_nullable

description

:::tip For developer debugging only, do not call this function manually in the production environment. :::

Syntax

T non_nullable(T expr)

Raise an error if expr is of not nullable, or is of nullable and contains a NULL value. Otherwise, returns the non-nullable data column of the input column.

example

mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1;
+------+------------------+
| k1   | non_nullable(k1) |
+------+------------------+
|    1 |                1 |
|    2 |                2 |
|    3 |                3 |
|    4 |                4 |
+------+------------------+

mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1;
ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]There's NULL value in column Nullable(Int32) which is illegal for non_nullable
mysql> select non_nullable(1);
ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]Try to use originally non-nullable column Int8 in nullable's non-nullable convertion.

keywords

non_nullable