st_isvalid 函数

适用于:已勾选“是”的 Databricks Runtime 17.1 及更高版本

Important

此功能目前以公共预览版提供。

如果输入 GEOMETRY 是 OGC 意义上的有效几何图形,则返回 true。

Syntax

st_isvalid ( geoExpr )

Arguments

  • geoExpr:一个 GEOMETRY 值。

Returns

BOOLEAN 类型的值,如果输入 GEOMETRY 是在 OGC 意义上有效的几何图形,则为 true。

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

Examples

-- Returns false for invalid geometry with self-intersecting polygon.
> SELECT st_isvalid(st_geomfromtext('POLYGON((0 0,10 10,10 0,0 10,0 0))'))
  false
-- Returns true for valid geometry.
> SELECT st_isvalid(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'))
  true