st_npoints function

适用于:勾选为是 Databricks SQL 勾选为是 Databricks 运行时 17.1 及以上 勾选 是 Lakehouse//RT

Important

支持 GEOGRAPHY 值以 公共预览版提供。 对 GEOMETRY 值的支持 已正式发布。

注释

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

返回输入 GEOGRAPHY 或 GEOMETRY 值中的非空点数。

此函数是函数的st_numpoints别名。

Syntax

st_npoints ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY 或 GEOMETRY value。

Returns

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

如果输入为 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