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

    https://github.com/apache/spark/pull/17100#discussion_r146208370
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
 ---
    @@ -270,12 +271,25 @@ trait CheckAnalysis extends PredicateHelper {
     
             operator match {
               case o if o.children.nonEmpty && o.missingInput.nonEmpty =>
    +            val resolver = plan.conf.resolver
    +            val attrsWithSameName = o.missingInput.filter(x =>
    +              o.inputSet.exists(y => resolver(x.name, y.name)))
                 val missingAttributes = o.missingInput.mkString(",")
    -            val input = o.inputSet.mkString(",")
    +            val availableAttributes = o.inputSet.mkString(",")
    +            val repeatedNameHint = if (attrsWithSameName.size > 0) {
    +              val commonNames = attrsWithSameName.map(_.name).mkString(",")
    +              s"""\n|Attribute(s) `$commonNames` seem to appear in two
    +                  |different datasets, with the same name."""
    +            } else {
    +              ""
    +            }
     
                 failAnalysis(
    -              s"resolved attribute(s) $missingAttributes missing from 
$input " +
    -                s"in operator ${operator.simpleString}")
    +              s"""Some resolved attribute(s) are not present among the 
available attributes
    +                |for a query.
    +                |$missingAttributes is not in 
$availableAttributes.$repeatedNameHint
    --- End diff --
    
    This may add an empty line if `repeatedNameHint` is an empty string?


---

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

Reply via email to