JoshRosen commented on code in PR #46908: URL: https://github.com/apache/spark/pull/46908#discussion_r1630802165
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala: ########## @@ -315,32 +317,34 @@ trait ColumnResolutionHelper extends Logging with DataTypeErrorsBase { }.map(e => Alias(e, nameParts.last)()) } - def innerResolve(e: Expression, isTopLevel: Boolean): Expression = withOrigin(e.origin) { + def innerResolve(e: Expression, isTopLevel: Boolean): Expression = { if (e.resolved || !e.containsAnyPattern(UNRESOLVED_ATTRIBUTE, TEMP_RESOLVED_COLUMN)) return e Review Comment: I think that Iv'e introduced a subtle bug here due to non-local return behavior: previously, the return was nested inside of a closure passed to `withOrigin` and returned from that closure, but now the return is returning from the _outer_ method which contains `innerResolve` rather than returning from `innerResolve` itself. An earlier version that I tested locally had used a return-free if-else pattern with additional braces to make the pattern clearer. Let me revert back to that here. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala: ########## @@ -315,32 +317,34 @@ trait ColumnResolutionHelper extends Logging with DataTypeErrorsBase { }.map(e => Alias(e, nameParts.last)()) } - def innerResolve(e: Expression, isTopLevel: Boolean): Expression = withOrigin(e.origin) { + def innerResolve(e: Expression, isTopLevel: Boolean): Expression = { if (e.resolved || !e.containsAnyPattern(UNRESOLVED_ATTRIBUTE, TEMP_RESOLVED_COLUMN)) return e Review Comment: I think that I've introduced a subtle bug here due to non-local return behavior: previously, the return was nested inside of a closure passed to `withOrigin` and returned from that closure, but now the return is returning from the _outer_ method which contains `innerResolve` rather than returning from `innerResolve` itself. An earlier version that I tested locally had used a return-free if-else pattern with additional braces to make the pattern clearer. Let me revert back to that here. -- 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