Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/20360#discussion_r163223074
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/python/ExtractPythonUDFs.scala
---
@@ -45,7 +45,8 @@ object ExtractPythonUDFFromAggregate extends
Rule[LogicalPlan] {
private def hasPythonUdfOverAggregate(expr: Expression, agg: Aggregate):
Boolean = {
expr.find {
- e => PythonUDF.isScalarPythonUDF(e) && e.find(belongAggregate(_,
agg)).isDefined
+ e => PythonUDF.isScalarPythonUDF(e) &&
+ (e.references.isEmpty || e.find(belongAggregate(_, agg)).isDefined)
--- End diff --
I just want to consider some literal inputs like `df2 =
df.distinct().withColumn("a", f_udf(f.lit("2")))`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]