File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,8 @@ 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.freshName(" rowsStack" )
202+ val rowData = ctx.addMutableState(" InternalRow[]" , " rows" ,
203+ v => s " $v = new InternalRow[ $numRows]; " )
203204 val values = children.tail
204205 val dataTypes = values.take(numFields).map(_.dataType)
205206 val code = ctx.splitExpressionsWithCurrentInputs(Seq .tabulate(numRows) { row =>
@@ -215,7 +216,6 @@ case class Stack(children: Seq[Expression]) extends Generator {
215216 val wrapperClass = classOf [mutable.WrappedArray [_]].getName
216217 ev.copy(code =
217218 s """
218- |InternalRow[] $rowData = new InternalRow[ $numRows];
219219 | $code
220220 | $wrapperClass<InternalRow> ${ev.value} = $wrapperClass$$ .MODULE $$ .make( $rowData);
221221 """ .stripMargin, isNull = " false" )
You can’t perform that action at this time.
0 commit comments