allisonwang-db commented on a change in pull request #32303: URL: https://github.com/apache/spark/pull/32303#discussion_r620004435
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala ########## @@ -392,16 +392,27 @@ case class UnresolvedStar(target: Option[Seq[String]]) extends Star with Unevalu throw QueryCompilationErrors.starExpandDataTypeNotSupportedError(target.get) } } else { - val from = input.inputSet.map(_.name).mkString(", ") - val targetString = target.get.mkString(".") - throw QueryCompilationErrors.cannotResolveStarExpandGivenInputColumnsError( - targetString, from) + // Change the unresolved star to an expanded star to indicate the star has been + // expanded once. + ExpandedStar(this) :: Nil } } override def toString: String = target.map(_ + ".").getOrElse("") + "*" } +/** + * Represent an [[UnresolvedStar]] that has been to expand once. + * This can be used to resolve a star expression using multiple plans. + */ +case class ExpandedStar(star: UnresolvedStar) extends Star with Unevaluable { Review comment: This is used to differenate between an unresolved star and a star that has been tried to resolved once. It's intended to keep the error message consistent when the star usage is invalid in an expression. But indeed this is confusing and I will think of other ways to check the invalid usage. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org