Skip to content

Commit

Permalink
[SPARK-22848][SQL] Eliminate mutable state from Stack
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

This PR eliminates mutable states from the generated code for `Stack`.

## How was this patch tested?

Existing test suites

Author: Kazuaki Ishizaki <ishizaki@jp.ibm.com>

Closes #20035 from kiszk/SPARK-22848.
  • Loading branch information
kiszk authored and cloud-fan committed Dec 21, 2017
1 parent d3ae3e1 commit cb9fc8d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ case class Stack(children: Seq[Expression]) extends Generator {

// Create the collection.
val wrapperClass = classOf[mutable.WrappedArray[_]].getName
ctx.addMutableState(
s"$wrapperClass<InternalRow>",
ev.value,
v => s"$v = $wrapperClass$$.MODULE$$.make($rowData);", useFreshName = false)
ev.copy(code = code, isNull = "false")
ev.copy(code =
s"""
|$code
|$wrapperClass<InternalRow> ${ev.value} = $wrapperClass$$.MODULE$$.make($rowData);
""".stripMargin, isNull = "false")
}
}

Expand Down

0 comments on commit cb9fc8d

Please sign in to comment.