jiayuasu commented on code in PR #621:
URL: https://github.com/apache/incubator-sedona/pull/621#discussion_r857045727


##########
sql/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala:
##########
@@ -1620,6 +1620,47 @@ case class ST_Reverse(inputExpressions: Seq[Expression])
 }
 
 /**
+ * Returns the nth point in the geometry, provided it is a linestring
+ *
+ * @param inputExpressions sequence of 2 input arguments, a geometry and a 
value 'n'
+ */
+case class ST_PointN(inputExpressions: Seq[Expression])
+  extends Expression with CodegenFallback {
+  inputExpressions.validateLength(2)
+
+  override def nullable: Boolean = true
+
+  lazy val GeometryFactory = new GeometryFactory()
+  lazy val emptyGeometry: GeometryCollection = 
GeometryFactory.createGeometryCollection(null)

Review Comment:
   This emptyGeometry is NOT consistent with PostGIS requirement. ST_PointN 
should return NULL if no input linestring. You return an empty 
GeometryCollection but not NULL. https://postgis.net/docs/ST_PointN.html
   
   Please fix this and add corresponding test cases for non-line string input.



-- 
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]

Reply via email to