Kontinuation commented on code in PR #704:
URL: https://github.com/apache/incubator-sedona/pull/704#discussion_r1007544693


##########
sql/src/main/scala/org/apache/sedona/sql/UDF/Catalog.scala:
##########
@@ -18,140 +18,149 @@
  */
 package org.apache.sedona.sql.UDF
 
+import org.apache.spark.sql.catalyst.FunctionIdentifier
+import org.apache.spark.sql.catalyst.expressions.{ExpectsInputTypes, 
Expression, ExpressionInfo}
+import org.apache.spark.sql.catalyst.expressions.Literal
 import org.apache.spark.sql.catalyst.analysis.FunctionRegistry.FunctionBuilder
 import org.apache.spark.sql.expressions.{Aggregator, 
UserDefinedAggregateFunction}
 import org.apache.spark.sql.sedona_sql.expressions.{ST_YMax, ST_YMin, _}
 import org.apache.spark.sql.sedona_sql.expressions.collect.{ST_Collect, 
ST_CollectionExtract}
 import org.apache.spark.sql.sedona_sql.expressions.raster.{RS_Add, RS_Append, 
RS_Array, RS_Base64, RS_BitwiseAnd, RS_BitwiseOr, RS_Count, RS_Divide, 
RS_FetchRegion, RS_GetBand, RS_GreaterThan, RS_GreaterThanEqual, RS_HTML, 
RS_LessThan, RS_LessThanEqual, RS_LogicalDifference, RS_LogicalOver, RS_Mean, 
RS_Mode, RS_Modulo, RS_Multiply, RS_MultiplyFactor, RS_Normalize, 
RS_NormalizedDifference, RS_SquareRoot, RS_Subtract}
 import org.locationtech.jts.geom.Geometry
+import org.locationtech.jts.operation.buffer.BufferParameters
+
+import scala.reflect.ClassTag
 
 object Catalog {
-  val expressions: Seq[FunctionBuilder] = Seq(
+
+  type FunctionDescription = (FunctionIdentifier, ExpressionInfo, 
FunctionBuilder)
+
+  val expressions: Seq[FunctionDescription] = Seq(
     // Expression for vectors
-    ST_PointFromText,

Review Comment:
   This is for supporting expressions with optional parameters while declaring 
the types of all parameters in `def inputTypes`. Such as `ST_MakeValid(geom: 
Geometry, keepCollapsed: Boolean = false)`, where the second parameter is 
optional.
   
   Before this patch expressions with optional parameters need to check the 
number of passed in arguments and resolve the values of optional parameters 
manually. This patch handles optional parameters in function builder registered 
to the catalog, so that default argument values will be filled in. Now 
expressions can declare all its parameters in `def inputTypes`, all the 
arguments will be type-checked, and they don't need to handle default arguments 
themselves.



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