st_dump
function
Applies to: Databricks Runtime 17.3 and above
Preview
This feature is in Public Preview.
Returns an array containing the single geometries in the input geometry.
Syntax
st_dump ( geoExpr )
Arguments
geoExpr
: AGEOMETRY
value.
Returns
A value of type ARRAY
whose elements are of the same type as geoExpr
. The output array contains the single geometries in the input GEOMETRY
value.
If the input GEOMETRY
value is a point, linestring, or polygon, an array containing the input GEOMETRY
value is returned.
If the input GEOMETRY
value is an empty multipoint, multilinestring, multipolygon, or geometry collection, an empty array is returned.
The SRID value of the GEOMETRY
values in the output array is the same as that of the input GEOMETRY
value.
The function returns NULL
if the input is NULL
.
Examples
SQL
> SELECT st_asewkt(g) FROM (SELECT explode(st_dump(st_geomfromtext('MULTILINESTRING((1 2,3 4),(7 8,6 5))', 3857))) g) ORDER BY 1;
SRID=3857;LINESTRING(1 2,3 4)
SRID=3857;LINESTRING(7 8,6 5)
> SELECT st_astext(g) FROM (SELECT explode(st_dump(st_geomfromtext('GEOMETRYCOLLECTION(POINT EMPTY,MULTIPOINT(5 6,EMPTY,3 4))'))) g) ORDER BY 1;
POINT EMPTY
POINT EMPTY
POINT(3 4)
POINT(5 6)