File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -199,8 +199,7 @@ case class Stack(children: Seq[Expression]) extends Generator {
199199
200200 override protected def doGenCode (ctx : CodegenContext , ev : ExprCode ): ExprCode = {
201201 // Rows - we write these into an array.
202- val rowData = ctx.addMutableState(" InternalRow[]" , " rows" ,
203- v => s " $v = new InternalRow[ $numRows]; " )
202+ val rowData = ctx.freshName(" rowsStack" )
204203 val values = children.tail
205204 val dataTypes = values.take(numFields).map(_.dataType)
206205 val code = ctx.splitExpressionsWithCurrentInputs(Seq .tabulate(numRows) { row =>
@@ -214,14 +213,11 @@ case class Stack(children: Seq[Expression]) extends Generator {
214213
215214 // Create the collection.
216215 val wrapperClass = classOf [mutable.WrappedArray [_]].getName
217- val wrappedArray = ctx.addMutableState(
218- s " $wrapperClass<InternalRow> " ,
219- " stackWrappedArray" ,
220- v => s " $v = $wrapperClass$$ .MODULE $$ .make( $rowData); " )
221216 ev.copy(code =
222217 s """
218+ |InternalRow[] $rowData = new InternalRow[ $numRows];
223219 | $code
224- | $wrapperClass<InternalRow> ${ev.value} = $wrappedArray ;
220+ | $wrapperClass<InternalRow> ${ev.value} = $wrapperClass $$ .MODULE $$ .make( $rowData ) ;
225221 """ .stripMargin, isNull = " false" )
226222 }
227223}
You can’t perform that action at this time.
0 commit comments