ueshin commented on code in PR #49386: URL: https://github.com/apache/spark/pull/49386#discussion_r1911767455
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala: ########## @@ -712,6 +717,109 @@ case class UnresolvedStarExceptOrReplace( } } +/** + * Represents some of the input attributes to a given relational operator, for example in + * `df.withColumn`. + * + * @param target an optional name that should be the target of the expansion. If omitted all + * targets' columns are produced. This can only be a table name. This + * is a list of identifiers that is the path of the expansion. + * + * @param colNames a list of column names that should be replaced or produced. + * + * @param exprs a list of expressions that should be used to replace the expressions removed by. + * + * @param explicitMetadata an optional list of explicit metadata to associate with the columns. + */ +case class UnresolvedStarWithColumns( + target: Option[Seq[String]], + colNames: Seq[String], + exprs: Seq[Expression], + explicitMetadata: Option[Seq[Metadata]] = None) + extends UnresolvedStarBase { + + override def children: Seq[Expression] = exprs + + override protected def withNewChildrenInternal( + newChildren: IndexedSeq[Expression]): UnresolvedStarWithColumns = + copy(exprs = newChildren) + + override def expand(input: LogicalPlan, resolver: Resolver): Seq[NamedExpression] = { + assert(colNames.size == exprs.size, Review Comment: I think if we don't remove the above check, assertions are enough as same as what `UnresolvedStarExceptOrReplace` does for `replacements`. Otherwise, yes, let's add a new error class. -- 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: reviews-unsubscr...@spark.apache.org 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