spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] HeartSaVioR commented on a change in pull request #26173: [SPARK-29503][SQL] Remove conversion CreateNamedStruct to CreateNamedStructUnsafe
Date Tue, 29 Oct 2019 14:46:19 GMT
HeartSaVioR commented on a change in pull request #26173: [SPARK-29503][SQL] Remove conversion
CreateNamedStruct to CreateNamedStructUnsafe
URL: https://github.com/apache/spark/pull/26173#discussion_r340121329
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameComplexTypeSuite.scala
 ##########
 @@ -64,6 +68,24 @@ class DataFrameComplexTypeSuite extends QueryTest with SharedSparkSession
{
     val ds100_5 = Seq(S100_5()).toDS()
     ds100_5.rdd.count
   }
+
+  test("SPARK-29503 nest unsafe struct inside safe array") {
+    withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "false") {
+      val df = spark.sparkContext.parallelize(Seq(Seq(1, 2, 3))).toDF("items")
+
+      // items: Seq[Int] => items.map { item => Seq(Struct(item)) }
+      val result = df.select(
+        new Column(MapObjects(
+          (item: Expression) => array(struct(new Column(item))).expr,
 
 Review comment:
   My guess of #25745 is, it was based on the assumption that it's safe to replace CreateNamedStruct
with CreateNamedStructUnsafe as we already have one path to do this - and this observation
broke the assumption. IMHO, once we found it's not safe to do this, the improvement has to
prove safety before we take its benefits into account.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


Mime
View raw message