shrirangmhalgi commented on code in PR #55892:
URL: https://github.com/apache/spark/pull/55892#discussion_r3284557213
##########
sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala:
##########
@@ -765,6 +765,37 @@ class GeneratorFunctionSuite extends SharedSparkSession {
Seq(Row(0, 10, 0, 10), Row(1, 20, 1, 20))
)
}
+
+ test("SPARK-48091: explode with transform should preserve struct field
aliases") {
+ val df = spark.createDataFrame(Seq((1, Array(1, 2, 3), Array(4, 5, 6))))
+ .toDF("id", "my_array", "my_array2")
+
+ // Without explode - aliases should work (baseline)
+ val good = df.select(
+ transform(col("my_array2"), x => struct(x.as("data"))).as("my_struct")
+ )
+ assert(good.schema("my_struct").dataType.asInstanceOf[types.ArrayType]
Review Comment:
Addressed this in the followup commit
--
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]