st_equals
function
Applies to: Databricks SQL
Databricks Runtime 17.1 and above
Preview
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 true if the two input GEOMETRY
values are geometrically equal, meaning they correspond to the same point set.
Syntax
st_equals ( geoExpr1, geoExpr2 )
Arguments
geoExpr1
: The firstGEOMETRY
value.geoExpr2
: The secondGEOMETRY
value.
Returns
A value of type BOOLEAN
, indicating whether the two input GEOMETRY
value are geometrically equal.
The function does not support geometry collections.
For more details and the formal definition, see the Equals predicate in the DE-9IM matrix definition.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If any of the two input geometries is a geometry collection, the function returns ST_INVALID_ARGUMENT.INVALID_TYPE.
- If the two input geometries have different SRID values, the function returns ST_DIFFERENT_SRID_VALUES.
Examples
SQL
-- Returns false as a point and polygon are not equal.
> SELECT st_equals(st_geomfromtext('POINT(1 1)'),st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'));
false
-- Returns true as the two polygons are geometrically equal.
> SELECT st_equals(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'),st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))'));
true