cloud-fan commented on a change in pull request #34352:
URL: https://github.com/apache/spark/pull/34352#discussion_r733473172
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/internal/BaseSessionStateBuilder.scala
##########
@@ -410,6 +415,35 @@ class SparkUDFExpressionBuilder extends
FunctionExpressionBuilder {
name, expr.inputTypes.size.toString, input.size)
}
expr
+ } else if (classOf[Aggregator[_, _, _]].isAssignableFrom(clazz)) {
+ val aggregator =
clazz.getConstructor().newInstance().asInstanceOf[Aggregator[Any, Any, Any]]
+
+ // Construct the input encoder
+ val mirror = universe.runtimeMirror(clazz.getClassLoader)
+ val classType = mirror.classSymbol(clazz)
+ val baseClassType = universe.typeOf[Aggregator[_, _,
_]].typeSymbol.asClass
+ val baseType =
universe.internal.thisType(classType).baseType(baseClassType)
+ val tpe = baseType.typeArgs.head
+ val cls = mirror.runtimeClass(tpe)
Review comment:
Is there any reference for the code above? The code looks obscure
--
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]