cloud-fan commented on a change in pull request #25204:
[SPARK-28441][SQL][Python] Fix error when non-foldable expression is used in
correlated scalar subquery
URL: https://github.com/apache/spark/pull/25204#discussion_r306368495
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala
##########
@@ -316,25 +316,54 @@ object RewriteCorrelatedScalarSubquery extends
Rule[LogicalPlan] {
newExpression.asInstanceOf[E]
}
+ private def removeAlias(expr: Expression): Expression = expr match {
+ case Alias(c, _) => removeAlias(c)
+ case _ => expr
+ }
+
+ /**
+ * Checks if given expression is foldable. Evaluates it and returns it as
literal, if yes.
+ * If not, returns the original expression without evaluation.
+ */
+ private def getEvalOrExpr(expr: Expression): Option[Expression] = {
Review comment:
`tryEvalExpr`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]