dtenedor commented on code in PR #60732:
URL: https://github.com/apache/spark/pull/60732#discussion_r4648243060
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala:
##########
@@ -723,6 +724,28 @@ case class UnresolvedStarExceptOrReplace(
case except: NamedExpression => except -> Seq.empty
}
+ // Each replacement takes the place of the top-level column that its
except names. Two copies
+ // of the same column, as in `SELECT x, x`, resolve to one attribute, so a
replacement for that
+ // name is ambiguous, as it would be for two different columns with the
name.
+ val replacementsByColumn: AttributeMap[NamedExpression] = replacements
match {
+ case Some(replacementList) =>
+ assert(exceptPairs.size == replacementList.size,
+ "The number of replacements must be the same as the number of
excepts")
+ if (exceptPairs.exists { case (_, nestedColumn) =>
nestedColumn.nonEmpty }) {
+ throw SparkException.internalError(
+ "An EXCEPT name with a replacement must resolve to a top-level
column")
+ }
+ excepts.zip(exceptPairs).foreach { case (exceptParts, (column, _)) =>
+ val copies =
expandedCols.map(_.toAttribute).filter(_.semanticEquals(column.toAttribute))
Review Comment:
@steveyzzz I merged the other PR https://github.com/apache/spark/pull/60629
that added the `|> EVAL` pipe operator. It seems this same bug that
@dongjoon-hyun found here also applies to this PR. Can you please sync from
master and apply this same bug fix to the new `|> EVAL` operator too? Thank you.
--
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]