amaliujia commented on code in PR #36503: URL: https://github.com/apache/spark/pull/36503#discussion_r879978761
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala: ########## @@ -752,9 +752,30 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog { expressions.exists(_.exists(_.semanticEquals(expr))) } + def checkOuterReferenceUtil(attrs: Seq[Attribute], outer: OuterReference): Unit = { + if (!attrs.exists(_.exprId == outer.exprId)) { + failAnalysis("outer attribute not found") + } + } + + def checkOuterReference(p: LogicalPlan, expr: SubqueryExpression): Unit = p match { + case f: Filter => Review Comment: Filter is the case where we saw this issue (Filter contains a exists or not exists and a subplan as its child, and in both there are the same relation that will be deduplicated). SQL UDF is a case that is not filter but also contains outer reference. That is a case that this fix is not aim at. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org