Kontinuation commented on code in PR #1811:
URL: https://github.com/apache/sedona/pull/1811#discussion_r1962676584


##########
common/src/main/java/org/apache/sedona/common/Functions.java:
##########
@@ -29,6 +29,7 @@
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.sedona.common.geometryObjects.Circle;
+import org.apache.sedona.common.geometryObjects.Geography;

Review Comment:
   It is possible in Spark, the way to do this is quite flexible but awkward.
   
   The implementation of `inputTypes` can inspect what is the types of the 
actual expressions passed into it, and return a suitable function signature. 
Examples are
   
   * Summary stats function: 
https://github.com/apache/sedona/blob/a8da3cdb0953ca06d1eb5a64e799f2da75d0e712/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/raster/RasterFunctions.scala#L140-L150
   * Inferred expression: 
https://github.com/apache/sedona/blob/sedona-1.7.0/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/InferredExpression.scala#L61-L79
   
   We can also inspect the types of inputs and run different code depending on 
input types in eval function:
   
   * Summary stats function: 
https://github.com/apache/sedona/blob/a8da3cdb0953ca06d1eb5a64e799f2da75d0e712/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/raster/RasterFunctions.scala#L105-L131
   
   Inferred expression encapsulates the above function overloading mechanism of 
Spark and supports delegating the Spark expression to Java functions according 
to their arity. It is possible to extend it to support more complex function 
overloading rules.
   
   



-- 
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: issues-unsubscr...@sedona.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to