isnotnull function
Applies to: Databricks SQL
Databricks Runtime
Returns true if expr is not NULL. This function is a synonym for expr IS NOT NULL.
Syntax
isnotnull(expr)
Arguments
expr: An expression of any type.
Returns
A BOOLEAN.
If expr is a VARIANT result of a:
- JSON path expression with a valid path,
parse_jsonfunction,variant_explodetable-valued function, orvariant_explode_outertable-valued function
the result is always true.
Use the is_variant_null function function to check if the VARIANT encoded value is NULL, or cast the VARIANT to a specific type and check if the result is NULL.
Examples
SQL
> SELECT isnotnull(1);
true
> SELECT isnotnull(NULL:INTEGER);
false
> SELECT isnotnull(parse_json('{"key": null}'):key);
true
> SELECT isnotnull(parse_json('{"key": null}'):wrongkey);
false
> SELECT !is_variant_null(parse_json('{"key": null}'):key);
false