Optimize ST_Touches
Return false when geometry envelopes don't intersect
@@ -698,6 +698,9 @@ public final class GeoFunctions
@SqlType(StandardTypes.BOOLEAN)
public static Boolean stTouches(@SqlType(GEOMETRY_TYPE_NAME) Slice left, @SqlType(GEOMETRY_TYPE_NAME) Slice right)
{
+ if (!envelopes(left, right, Envelope::intersect)) {
+ return false;
+ }
OGCGeometry leftGeometry = deserialize(left);
OGCGeometry rightGeometry = deserialize(right);
verifySameSpatialReference(leftGeometry, rightGeometry);
