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 {
199
199
200
200
override protected def doGenCode (ctx : CodegenContext , ev : ExprCode ): ExprCode = {
201
201
// 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]; " )
203
204
val values = children.tail
204
205
val dataTypes = values.take(numFields).map(_.dataType)
205
206
val code = ctx.splitExpressionsWithCurrentInputs(Seq .tabulate(numRows) { row =>
@@ -215,7 +216,6 @@ case class Stack(children: Seq[Expression]) extends Generator {
215
216
val wrapperClass = classOf [mutable.WrappedArray [_]].getName
216
217
ev.copy(code =
217
218
s """
218
- |InternalRow[] $rowData = new InternalRow[ $numRows];
219
219
| $code
220
220
| $wrapperClass<InternalRow> ${ev.value} = $wrapperClass$$ .MODULE $$ .make( $rowData);
221
221
""" .stripMargin, isNull = " false" )
You can’t perform that action at this time.
0 commit comments