cloud-fan commented on a change in pull request #34473:
URL: https://github.com/apache/spark/pull/34473#discussion_r742112070



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
##########
@@ -297,6 +297,19 @@ class SimpleFunctionRegistry
     extends SimpleFunctionRegistryBase[Expression]
     with FunctionRegistry {
 
+  override def registerFunction(
+      name: FunctionIdentifier,
+      info: ExpressionInfo,
+      builder: FunctionBuilder): Unit = {
+    // We wrap all the functions to `RegisteredFunction`, so that during the 
analysis,
+    // we can identify the functions among the expressions. It will get 
replaced at
+    // runtime (currently by the optimizer) to the actual function.
+    def wrappedBuilder: FunctionBuilder = (e: Seq[Expression]) => {
+      RegisteredSimpleFunction(name, builder(e))

Review comment:
       I would just call it `RegisteredFunction`

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
##########
@@ -1088,3 +1088,11 @@ trait ComplexTypeMergingExpression extends Expression {
 trait UserDefinedExpression {
   def name: String
 }
+
+case class RegisteredSimpleFunction(

Review comment:
       can we check the EXPLAIN output? we probably need to override `sql` here.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to