cloud-fan commented on code in PR #44532:
URL: https://github.com/apache/spark/pull/44532#discussion_r1442741533
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala:
##########
@@ -487,42 +487,69 @@ trait ColumnResolutionHelper extends Logging with
DataTypeErrorsBase {
// original expression as it is.
private def tryResolveColumnByPlanId(
e: Expression,
- q: LogicalPlan,
- idToPlan: mutable.HashMap[Long, LogicalPlan] = mutable.HashMap.empty):
Expression = e match {
+ q: Seq[LogicalPlan]): Expression = e match {
case u: UnresolvedAttribute =>
- resolveUnresolvedAttributeByPlanId(
- u, q, idToPlan: mutable.HashMap[Long, LogicalPlan]
- ).getOrElse(u)
+ u.getTagValue(LogicalPlan.PLAN_ID_TAG) match {
+ case Some(id) =>
+ resolveUnresolvedAttributeByPlanId(u, id, q)
+ case _ => u
+ }
case _ if e.containsPattern(UNRESOLVED_ATTRIBUTE) =>
- e.mapChildren(c => tryResolveColumnByPlanId(c, q, idToPlan))
+ e.mapChildren(c => tryResolveColumnByPlanId(c, q))
case _ => e
}
private def resolveUnresolvedAttributeByPlanId(
Review Comment:
We don't need this method if the caller of it can get the `isMetadataAccess`
flag first.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala:
##########
@@ -487,42 +487,69 @@ trait ColumnResolutionHelper extends Logging with
DataTypeErrorsBase {
// original expression as it is.
private def tryResolveColumnByPlanId(
e: Expression,
- q: LogicalPlan,
- idToPlan: mutable.HashMap[Long, LogicalPlan] = mutable.HashMap.empty):
Expression = e match {
+ q: Seq[LogicalPlan]): Expression = e match {
case u: UnresolvedAttribute =>
- resolveUnresolvedAttributeByPlanId(
- u, q, idToPlan: mutable.HashMap[Long, LogicalPlan]
- ).getOrElse(u)
+ u.getTagValue(LogicalPlan.PLAN_ID_TAG) match {
+ case Some(id) =>
+ resolveUnresolvedAttributeByPlanId(u, id, q)
+ case _ => u
+ }
case _ if e.containsPattern(UNRESOLVED_ATTRIBUTE) =>
- e.mapChildren(c => tryResolveColumnByPlanId(c, q, idToPlan))
+ e.mapChildren(c => tryResolveColumnByPlanId(c, q))
case _ => e
}
private def resolveUnresolvedAttributeByPlanId(
Review Comment:
We don't need this method if the caller of it can get the `isMetadataAccess`
flag first.
--
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]