st_npoints 函数

适用于:检查标记为“是”的 Databricks SQL 检查标记为“是”是 Databricks Runtime 17.1 及更高版本

Important

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

注释

此功能在 Databricks SQL 经典仓库上不可用。 若要详细了解 Databricks SQL 仓库,请参阅 SQL 仓库类型

返回输入 GEOGRAPHYGEOMETRY 值中的非空点数。

Syntax

st_npoints ( geoExpr )

Arguments

  • geoExprGEOGRAPHYGEOMETRY值。

Returns

类型的 INT值,表示输入 GEOGRAPHYGEOMETRY 值中非空点的数目。

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

Examples

-- Returns the number of points in a non-empty multipoint geometry.
> SELECT st_npoints(st_geomfromtext('MULTIPOINT(10 34,44 57,EMPTY)'));
  2
-- Returns the number of points in an empty multipoint geometry.
> SELECT st_npoints(st_geomfromtext('MULTIPOINT(EMPTY,EMPTY)'));
  0
-- Returns the number of points in a non-empty polygon geometry.
> SELECT st_npoints(st_geomfromtext('POLYGON((0 0,1 0,1 1,0 1,0 0))'));
  5