tanelk commented on a change in pull request #33956:
URL: https://github.com/apache/spark/pull/33956#discussion_r706848231



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala
##########
@@ -33,7 +33,8 @@ trait QueryPlanConstraints extends ConstraintHelper { self: 
LogicalPlan =>
         .union(inferAdditionalConstraints(validConstraints))
         .union(constructIsNotNullConstraints(validConstraints, output))
         .filter { c =>
-          c.references.nonEmpty && c.references.subsetOf(outputSet) && 
c.deterministic
+          (c.references.nonEmpty && c.references.subsetOf(outputSet) || 
c.references.isEmpty) &&

Review comment:
       I agree with @HyukjinKwon . In the `InferFiltersFromGenerate` we ignore 
expressions `e.children.forall(_.foldable)`. Unfortunatelly the `ScalaUDF` is 
never foldable (perhaps it could be). I would recomend turning this optimizer 
of, when the child expression is instance of 
`org.apache.spark.sql.catalyst.expressions.UserDefinedExpression`.




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