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

 ##########
 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:
   Just to follow up review comment clearly, there's no 
`CodegenContext,generateExpressionAndCopyIfUnsafe`. Maybe you referred to 
`makeCopyIfInstanceOf` inside of `MapObjects.doGenCode`, or suggest to create a 
new method `CodegenContext,generateExpressionAndCopyIfUnsafe`?

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