cloud-fan commented on code in PR #39142:
URL: https://github.com/apache/spark/pull/39142#discussion_r1053904914


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/PythonUDF.scala:
##########
@@ -64,7 +68,17 @@ case class PythonUDF(
 
   override def toString: String = s"$name(${children.mkString(", 
")})#${resultId.id}$typeSuffix"
 
-  final override val nodePatterns: Seq[TreePattern] = Seq(PYTHON_UDF)
+  // SPARK-41633: We should check whether to update the node patterns when 
adding a new eval type.
+  private def nodePatternsOfPythonFunction: Seq[TreePattern] = {
+    if (PythonUDF.isGroupedAggPandasUDFEvalType(evalType)) {
+      Seq(AGGREGATE_EXPRESSION)

Review Comment:
   I think it's better to make node pattern match the node type. We created 
node patterns to speed up `isInstanceOf` check, not to replace it. Even if we 
fix the node pattern here, `expr.exists(_.isInstanceOf[AggregateExpression])` 
is still broken.
   
   I think we should have a `PythonUDAF` that indicates aggregate function 
explicitly, instead of relying on node pattern.



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