ulysses-you commented on a change in pull request #30974:
URL: https://github.com/apache/spark/pull/30974#discussion_r551100405
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
##########
@@ -165,6 +165,10 @@ class Column(val expr: Expression) extends Logging {
/** Creates a column based on the given expression. */
private def withExpr(newExpr: Expression): Column = new Column(newExpr)
+ private def existsUnresolvedExpr(expr: Expression): Boolean = {
Review comment:
looks better.
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -2613,6 +2613,19 @@ class DataFrameSuite extends QueryTest
val df = l.join(r, $"col2" === $"col4", "LeftOuter")
checkAnswer(df, Row("2", "2"))
}
+
+ test("SPARK-33939: Make Column.named use UnresolvedAlias to assign name") {
+ val df = spark.range(1).selectExpr("id as id1", "id as id2")
+ val df1 = df.selectExpr("cast(struct(id1, id2).id1 as int)")
+ assert(df1.schema.head.name == "CAST(struct(id1, id2).id1 AS INT)")
Review comment:
Added.
----------------------------------------------------------------
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]