Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19827#discussion_r153233999
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala
---
@@ -49,25 +49,18 @@ object GenerateUnsafeProjection extends
CodeGenerator[Seq[Expression], UnsafePro
input: String,
fieldTypes: Seq[DataType],
bufferHolder: String): String = {
+ // Puts `input` in a local variable to avoid to re-evaluate it if it's
a statement.
+ val tmpInput = ctx.freshName("tmpInput")
--- End diff --
Here I follow the `GenerateSafeProjection` to create temp variable only
when dealing with struct, array, map, instead of when getting fields from
struct.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]