cloud-fan commented on a change in pull request #30974:
URL: https://github.com/apache/spark/pull/30974#discussion_r557842200
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
##########
@@ -169,38 +169,23 @@ class Column(val expr: Expression) extends Logging {
* Returns the expression for this column either with an existing or auto
assigned name.
*/
private[sql] def named: NamedExpression = expr match {
- // Wrap UnresolvedAttribute with UnresolvedAlias, as when we resolve
UnresolvedAttribute, we
- // will remove intermediate Alias for ExtractValue chain, and we need to
alias it again to
- // make it a NamedExpression.
- case u: UnresolvedAttribute => UnresolvedAlias(u)
-
- case u: UnresolvedExtractValue => UnresolvedAlias(u)
-
case expr: NamedExpression => expr
// Leave an unaliased generator with an empty list of names since the
analyzer will generate
// the correct defaults after the nested expression's type has been
resolved.
case g: Generator => MultiAlias(g, Nil)
- case func: UnresolvedFunction => UnresolvedAlias(func,
Some(Column.generateAlias))
-
// If we have a top level Cast, there is a chance to give it a better
alias, if there is a
// NamedExpression under this Cast.
case c: Cast =>
Review comment:
can we just do `case c: Cast => UnresolvedAlias(c,
Some(Column.generateAlias))`?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]