st_numpoints function

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

重要

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

注释

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

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

此函数是函数的st_npoints别名。

Syntax

st_numpoints ( geoExpr )

Arguments

  • geoExpr: A GEOGRAPHY 或 GEOMETRY value。

退货

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

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

示例

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