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 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 approach here:
https://github.com/apache/spark/pull/46908/commits/72cb44d98b0287db637a87c4bdb0ce8b6bd36220
**Edit**: on reflection, I'm not actually sure whether there is a bug there
but the non-local return in a nested method is hard to reason about so I think
the if-else is clearer.
--
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]