Github user mgaido91 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19797#discussion_r152864775
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
 ---
    @@ -87,14 +87,13 @@ private [sql] object GenArrayData {
           elementType: DataType,
           elementsCode: Seq[ExprCode],
           isMapKey: Boolean): (String, Seq[String], String, String) = {
    -    val arrayName = ctx.freshName("array")
         val arrayDataName = ctx.freshName("arrayData")
         val numElements = elementsCode.length
     
         if (!ctx.isPrimitiveType(elementType)) {
    +      val arrayName = "arrayObject"
           val genericArrayClass = classOf[GenericArrayData].getName
    -      ctx.addMutableState("Object[]", arrayName,
    -        s"$arrayName = new Object[$numElements];")
    +      ctx.reuseOrAddMutableState("Object[]", arrayName)
    --- End diff --
    
    is there any specific reason why here we are not following the approach 
used for `IntWrapper` and `LongWrapper` above? ie. defining it as a local 
variable, instead of reusing the same global object?


---

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

Reply via email to