is_variant_null function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 15.3 and later

Tests whether variantExpr is a VARIANT-encoded NULL.

Syntax

is_variant_null ( variantExpr )

Arguments

  • variantExpr: A VARIANT expression to check if it is VARIANT-encoded NULL.

Returns

A BOOLEAN.

Notes

This function checks whether the variantExpr is storing a VARIANT encoded NULL. Use the IS NULL operator to check if the input variantExpr is NULL.

Examples

-- Simple example
> SELECT is_variant_null(v:key), is_variant_null(v:a)
    FROM VALUES(parse_json('{"key": null, "a": 1}')) AS T(v)
  true false

-- difference between is_variant_null and is null
> SELECT is_variant_null(v:key), v:key IS NULL
    FROM VALUES(parse_json('{"key": null}')) AS T(v)
  true false