You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Hisoka-X (via GitHub)" <gi...@apache.org> on 2023/05/17 05:40:31 UTC

[GitHub] [spark] Hisoka-X commented on a diff in pull request #41187: [SPARK-43522][SQL] Fix creating struct column name with index of array

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


##########
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, "=")

Review Comment:
   The difference are one use alias to struct elements, another one don't use alias. The one use alias will get rigt answer before this PR, another will not. I move it from jira ticket.
   
   > I think it would be easier to compare to a DataFrame with the expected result.
   
   Just check expected result is good for me. I will change it
   



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org