steveyzzz commented on code in PR #60629:
URL: https://github.com/apache/spark/pull/60629#discussion_r4634106079
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala:
##########
@@ -800,6 +808,32 @@ case class UnresolvedStarExceptOrReplace(
filterColumns(expandedCols, exceptPairs)
}
+
+ /**
+ * Expands the star, replacing the columns that match an EXCEPT name and
appending the
+ * replacements of the EXCEPT names that match no column, in EXCEPT list
order.
+ */
+ private def expandStarAppendingMissingReplacements(
+ parameters: ExpandStarParameters): Seq[NamedExpression] = {
+ val replacementList = replacements match {
+ case Some(list) if list.size == excepts.size => list
+ case _ => throw SparkException.internalError(
+ "Appending missing replacements requires one replacement per except")
+ }
+ val expandedAttributes =
AttributeSeq(super.expandStar(parameters).map(_.toAttribute))
+ val (presentExceptsAndReplacements, missingExceptsAndReplacements) =
+ excepts.zip(replacementList).partition { case (exceptParts, _) =>
+ expandedAttributes.resolve(exceptParts, parameters.resolver).isDefined
Review Comment:
Here is the `SET` fix: #60732
([SPARK-62102](https://issues.apache.org/jira/browse/SPARK-62102)).
--
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]