Skip to content

Commit

Permalink
Test for ST_Buffer NPE fix
Browse files Browse the repository at this point in the history
Upgrading to Esri 2.2.3 included the fix in Esri/geometry-api-java#243
Fixes prestodb#13194
  • Loading branch information
jagill authored and Sreeni Viswanadha committed Jan 15, 2020
1 parent b27e592 commit 1b138eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion presto-docs/src/main/sphinx/functions/geospatial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ Operations
.. function:: ST_Buffer(Geometry, distance) -> Geometry

Returns the geometry that represents all points whose distance from the
specified geometry is less than or equal to the specified distance.
specified geometry is less than or equal to the specified distance. If the
points of the geometry are extremely close together (``delta < 1e-8``), this
might return an empty geometry.

.. function:: ST_Difference(Geometry, Geometry) -> Geometry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ public void testSTBuffer()
// infinity() and nan() distance
assertFunction("ST_AsText(ST_Buffer(ST_Point(0, 0), infinity()))", VARCHAR, "MULTIPOLYGON EMPTY");
assertInvalidFunction("ST_Buffer(ST_Point(0, 0), nan())", "distance is NaN");

// For small polygons, there was a bug in ESRI that throw an NPE. This
// was fixed (https://github.com/Esri/geometry-api-java/pull/243) to
// return an empty geometry instead. Ideally, these would return
// something approximately like `ST_Buffer(ST_Centroid(geometry))`.
assertFunction("ST_IsEmpty(ST_Buffer(ST_Buffer(ST_Point(177.50102959662, 64.726807421691), 0.0000000001), 0.00005))",
BOOLEAN, true);
assertFunction("ST_IsEmpty(ST_Buffer(ST_GeometryFromText(" +
"'POLYGON ((177.0 64.0, 177.0000000001 64.0, 177.0000000001 64.0000000001, 177.0 64.0000000001, 177.0 64.0))'" +
"), 0.01))", BOOLEAN, true);
}

@Test
Expand Down

0 comments on commit 1b138eb

Please sign in to comment.