Zum Inhalt springen

Liefert für einen Nullable-Typ einen äquivalenten Wert ohne Nullable. Ist der ursprüngliche Wert NULL, ist das Ergebnis nicht definiert.

func.assume_not_null(<x>)
With a table like:
┌────────────────────┐
│ x │ y │
├────────────────────┤
│ 1 │ NULL │
│ 2 │ 3 │
└────────────────────┘
func.assume_not_null(y)
┌─────────────────────────┐
│ func.assume_not_null(y) │
├─────────────────────────┤
│ 0 │
│ 3 │
└─────────────────────────┘
ASSUME_NOT_NULL(<x>)

Gibt für einen Typ ohne Nullable den ursprünglichen Datentyp zurück. Für einen Nullable-Typ wird der eingebettete Datentyp ohne Nullable zurückgegeben.

CREATE TABLE default.t_null ( x int, y int null);
INSERT INTO default.t_null values (1, null), (2, 3);
SELECT ASSUME_NOT_NULL(y), REMOVE_NULLABLE(y) FROM t_null;
┌─────────────────────────────────────────┐
│ assume_not_null(y) │ remove_nullable(y) │
├────────────────────┼────────────────────┤
│ 0 │ 0 │
│ 3 │ 3 │
└─────────────────────────────────────────┘