h3_isvalid function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.3 LTS and above

Returns true if the input BIGINT or STRING is a valid H3 cell ID.

Syntax

h3_isvalid ( expr )

Arguments

  • expr: A BIGINT expression, or a STRING expression.

Returns

A value of type BOOLEAN, indicating whether the input BIGINT or STRING corresponds to a valid H3 cell ID or not.

The function returns NULL if the input is NULL.

Examples

-- Simple example taking a long as input.
> SELECT h3_isvalid(599686042433355775)
  true

-- Simple example taking a valid hexadecimal string as input.
> SELECT h3_isvalid('85283473fffffff')
  true

-- Example taking a long as input that is not a valid H3 cell ID.
> SELECT h3_isvalid(599686042433355776)
  false

-- Example where the input is an invalid hexadecimal string.
> SELECT h3_isvalid('I am not an H3 cell ID')
  false