jiayuasu commented on code in PR #853:
URL: https://github.com/apache/sedona/pull/853#discussion_r1222589101
##########
docs/api/sql/Function.md:
##########
@@ -1668,3 +1668,17 @@ SELECT ST_ZMin(ST_GeomFromText('LINESTRING(1 3 4, 5 6
7)'))
Output: `4.0`
+## ST_NumPoints
Review Comment:
Docs need to be sorted alphabetically. Please explain the behavior if a
non-linestring geometry is given.
##########
docs/api/flink/Function.md:
##########
@@ -1035,3 +1035,18 @@ SELECT ST_ZMin(ST_GeomFromText('LINESTRING(1 3 4, 5 6
7)'))
```
Output: `4.0`
+
+## ST_NumPoints
Review Comment:
Docs need to be sorted alphabetically. Please explain the behavior if a
non-linestring geometry is given.
##########
common/src/main/java/org/apache/sedona/common/Functions.java:
##########
@@ -845,6 +845,14 @@ private static Coordinate[] extractCoordinates(Geometry
geometry) {
return coordinates;
}
+ public static int numPoints(Geometry geometry) throws Exception {
+ String geometryType = geometry.getGeometryType();
+ if (!(Geometry.TYPENAME_LINESTRING.equalsIgnoreCase(geometryType))) {
+ throw new Exception("Unsupported geometry type: " + geometryType);
Review Comment:
Maybe better if throw `IllegalArgumentException`. Please also add in the
error message that only LineString type is accepted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]