Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5062#discussion_r26554868
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -237,22 +237,35 @@ class Analyzer(catalog: Catalog,
           // Special handling for cases when self-join introduce duplicate 
expression ids.
           case j @ Join(left, right, _, _) if 
left.outputSet.intersect(right.outputSet).nonEmpty =>
             val conflictingAttributes = 
left.outputSet.intersect(right.outputSet)
    +        logDebug(s"Conflicting attributes 
${conflictingAttributes.mkString(",")} in $j")
     
    -        val (oldRelation, newRelation, attributeRewrites) = right.collect {
    +        val (oldRelation, newRelation) = right.collect {
    +          // Handle base relations that might appear more than once.
               case oldVersion: MultiInstanceRelation
                   if 
oldVersion.outputSet.intersect(conflictingAttributes).nonEmpty =>
                 val newVersion = oldVersion.newInstance()
    -            val newAttributes = 
AttributeMap(oldVersion.output.zip(newVersion.output))
    -            (oldVersion, newVersion, newAttributes)
    +            (oldVersion, newVersion)
    +
    +          // Handle projects that create conflicting aliases.
    +          case oldVersion @ Project(projectList, child)
    --- End diff --
    
    Probably a doable solution is add a `Project` node on top of cached plan or 
temporal table when `lookupRelation`.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to