cloud-fan commented on code in PR #42803: URL: https://github.com/apache/spark/pull/42803#discussion_r1314899526
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala: ########## @@ -196,8 +196,11 @@ trait ColumnResolutionHelper extends Logging { try { val resolved = innerResolve(expr, isTopLevel = true) - val withOuterResolved = if (allowOuter) resolveOuterRef(resolved) else resolved - resolveVariables(withOuterResolved) Review Comment: This is the bug. Sometimes we only want to do basic column resolution first, and then try some special resolution logic (see `ResolveReferencesInAggregat` as an example), and finally resolve outer references. The code before always tried to resolve the SQL variable. To avoid hitting similar bugs, I refactored the code a bit to have a `last resort` step for column resolution, which contains resolving outer references and SQL variables. -- 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