aaronlewism commented on a change in pull request #26173: [SPARK-29503][SQL] 
Copy result row from RowWriter in GenerateUnsafeProjection when the expression 
is lambdaFunction in MapObject
URL: https://github.com/apache/spark/pull/26173#discussion_r336740584
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala
 ##########
 @@ -310,8 +312,19 @@ object GenerateUnsafeProjection extends 
CodeGenerator[Seq[Expression], UnsafePro
          |$evalSubexpr
          |$writeExpressions
        """.stripMargin
+
+    val runInsideLoop = expressions.exists {
+      case _: LambdaVariable => true
+      case _ => false
+    }
+    val extractValueCode = if (runInsideLoop) {
+      s"$rowWriter.getRow().copy()"
+    } else {
+      s"$rowWriter.getRow()"
+    }
 
 Review comment:
   Nice solution! Correct me if I'm wrong, but I believe this means it should 
be safe to get rid of the top-level copy from applying `makeCopyIfInstanceOf` 
in `MapObjects`

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to