h3_isvalid 函数

适用于:check marked yes Databricks SQL check marked yes Databricks Runtime 11.2 及更高版本

如果输入 BIGINT 或 STRING 是有效的 H3 单元 ID,则返回 true。

语法

h3_isvalid ( expr )

参数

  • expr:一个 BIGINT 表达式或 STRING 表达式。

返回

BOOLEAN 类型的值,指示输入 BIGINT 或 STRING 是否对应于有效的 H3 单元 ID。

如果输入为 NULL,则该函数返回 NULL。

示例

-- 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