Hisoka-X commented on code in PR #41187:
URL: https://github.com/apache/spark/pull/41187#discussion_r1196009862


##########
sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala:
##########
@@ -280,6 +280,20 @@ class SQLQuerySuite extends QueryTest with 
SharedSparkSession with AdaptiveSpark
     )
   }
 
+  test("SPARK-43522: Fix creating struct column name with index of array") {
+
+    val data = Seq("a=b,c=d,d=f").toDF.withColumn("key_value", split('value, 
","))
+
+    val df = data.withColumn("map_entry", transform(col("key_value"), x => 
struct(split(x, "=")
+      .getItem(0).as("col1"), split(x, "=").getItem(1).as("col2")))).collect()
+
+    val df2 = data.withColumn("map_entry", transform(col("key_value"), x => 
struct(split(x, "=")
+      .getItem(0), split(x, "=").getItem(1)))).collect()
+
+    assert(df2 sameElements df)

Review Comment:
   Fixed. Thanks for remind.



-- 
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

Reply via email to