Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19797#discussion_r152627225
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
---
@@ -87,31 +87,36 @@ private [sql] object GenArrayData {
elementType: DataType,
elementsCode: Seq[ExprCode],
isMapKey: Boolean): (String, Seq[String], String, String) = {
- val arrayName = ctx.freshName("array")
+ val arrayName = "array"
val arrayDataName = ctx.freshName("arrayData")
val numElements = elementsCode.length
if (!ctx.isPrimitiveType(elementType)) {
val genericArrayClass = classOf[GenericArrayData].getName
- ctx.addMutableState("Object[]", arrayName,
- s"$arrayName = new Object[$numElements];")
+ if (!ctx.mutableStates.exists(s => s._1 == arrayName)) {
--- End diff --
To be honest, I do not know whether to stop reusing an object is good or
not.
@cloud-fan @maropu @viirya I would like to hear your opinions.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]