kvpankaj1999 commented on code in PR #622:
URL: https://github.com/apache/incubator-sedona/pull/622#discussion_r857051665


##########
sql/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala:
##########
@@ -123,6 +123,69 @@ case class ST_YMin(inputExpressions: Seq[Expression])
     copy(inputExpressions = newChildren)
   }
 }
+
+/**
+ * Test if returning Max X coordinate value.
+ *
+ * @param inputExpressions
+ */
+case class ST_XMax(inputExpressions: Seq[Expression])
+  extends UnaryGeometryExpression with CodegenFallback {
+  assert(inputExpressions.length == 1)
+
+
+  override protected def nullSafeEval(geometry: Geometry): Any = {
+    var coord:Array[Coordinate] = geometry.getCoordinates()
+    var maxval = Double.MinValue
+    for (point<-coord) {
+      if(point.getX()>maxval){
+        maxval = point.getX()
+      }
+    }
+    maxval
+
+  }
+
+  override def dataType: DataType = DoubleType
+
+  override def children: Seq[Expression] = inputExpressions
+
+  protected def withNewChildrenInternal(newChildren: IndexedSeq[Expression]) = 
{
+    copy(inputExpressions = newChildren)
+  }
+}
+
+/**
+ * Test if returning Min X coordinate value.
+ *
+ * @param inputExpressions
+ */
+case class ST_XMin(inputExpressions: Seq[Expression])
+  extends UnaryGeometryExpression with CodegenFallback {
+  assert(inputExpressions.length == 1)
+
+
+  override protected def nullSafeEval(geometry: Geometry): Any = {
+    var coord:Array[Coordinate] = geometry.getCoordinates()
+    var minval = Double.MaxValue
+    for (point<-coord) {
+      if(point.getX()<minval){
+        minval = point.getX()
+      }
+    }
+    minval
+
+  }
+
+  override def dataType: DataType = DoubleType
+
+  override def children: Seq[Expression] = inputExpressions
+
+  protected def withNewChildrenInternal(newChildren: IndexedSeq[Expression]) = 
{
+    copy(inputExpressions = newChildren)
+  }
+}
+
 case class ST_3DDistance(inputExpressions: Seq[Expression])
   extends BinaryGeometryExpression with CodegenFallback {

Review Comment:
   I have removed my previous implementation of my functions from between and 
added them at the end of the file. When I compared the current file in master 
branch and my file in local there was no difference in the number of lines of 
code. Can you please let me know where exactly I have changed the file 
elsewhere.



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