Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the number of geometries in the input GEOMETRY value.
Syntax
st_numgeometries ( geoExpr )
Arguments
geoExpr: AGEOMETRYvalue.
Returns
A value of type INT, representing the number of geometries in the input GEOMETRY value.
The function returns NULL if the input is NULL.
Examples
-- Returns the number of geometries in a non-empty multipoint geometry.
> SELECT st_numgeometries(st_geomfromtext('MULTIPOINT(10 34,44 57,EMPTY)'));
3
-- Returns the number of geometries in an empty polygon geometry.
> SELECT st_numgeometries(st_geomfromtext('POLYGON EMPTY'));
0
-- Returns the number of geometries in a non-empty polygon geometry.
> SELECT st_numgeometries(st_geomfromtext('POLYGON((0 0,1 0,1 1,0 1,0 0))'));
1
-- Returns the number of geometries in a non-empty geometry collection.
> SELECT st_numgeometries(st_geomfromtext('GEOMETRYCOLLECTION(LINESTRING EMPTY,GEOMETRYCOLLECTION(POINT(1 2),POLYGON((0 0,1 0,0 1,0 0))))'));
2