Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14083#discussion_r69984539
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LogicalPlan.scala
 ---
    @@ -165,111 +169,99 @@ abstract class LogicalPlan extends 
QueryPlan[LogicalPlan] with Logging {
       def resolveQuoted(
           name: String,
           resolver: Resolver): Option[NamedExpression] = {
    -    resolve(UnresolvedAttribute.parseAttributeName(name), output, resolver)
    +    
outputAttributeResolver.resolve(UnresolvedAttribute.parseAttributeName(name), 
resolver)
       }
     
       /**
    -   * Resolve the given `name` string against the given attribute, 
returning either 0 or 1 match.
    -   *
    -   * This assumes `name` has multiple parts, where the 1st part is a 
qualifier
    -   * (i.e. table name, alias, or subquery alias).
    -   * See the comment above `candidates` variable in resolve() for 
semantics the returned data.
    +   * Refreshes (or invalidates) any metadata/data cached in the plan 
recursively.
        */
    -  private def resolveAsTableColumn(
    -      nameParts: Seq[String],
    -      resolver: Resolver,
    -      attribute: Attribute): Option[(Attribute, List[String])] = {
    -    assert(nameParts.length > 1)
    -    if (attribute.qualifier.exists(resolver(_, nameParts.head))) {
    -      // At least one qualifier matches. See if remaining parts match.
    -      val remainingParts = nameParts.tail
    -      resolveAsColumn(remainingParts, resolver, attribute)
    -    } else {
    -      None
    -    }
    +  def refresh(): Unit = children.foreach(_.refresh())
    +}
    +
    +/**
    + * Helper class for (LogicalPlan) attribute resolution. This class indexes 
attributes by their
    + * case-in-sensitive name, and checks potential candidates using the given 
Resolver. Both qualified
    --- End diff --
    
    The `resolve` methods takes a `Resolver` as its parameter. This allows us 
to use either case sensitive or insensitive attribute resolution depending on 
the `Resolver` passed. The names of both classes are confusing and I might 
rename the `AttributeResolver` class to `AttributeIndex` or something like 
that...
    
    The `AttributeResolver` creates two indexes based on the lower case 
(qualified) attribute name; we do an initial lookup based on the lower case 
name, and then use the `Resolver` for the actual attribute selection. This 
allows us to do fast(er) and correct lookups.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to