Skip to content

Commit

Permalink
Store the output of a generator in a val.
Browse files Browse the repository at this point in the history
This prevents it from changing during serialization.
  • Loading branch information
marmbrus committed Oct 4, 2014
1 parent cf1d32e commit efa32eb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ case class Generate(
child: SparkPlan)
extends UnaryNode {

protected def generatorOutput: Seq[Attribute] = {
// This must be a val since the generator output expr ids are not preserved by serialization.
protected val generatorOutput: Seq[Attribute] = {
if (join && outer) {
generator.output.map(_.withNullability(true))
} else {
Expand All @@ -62,7 +63,7 @@ case class Generate(
newProjection(child.output ++ nullValues, child.output)

val joinProjection =
newProjection(child.output ++ generator.output, child.output ++ generator.output)
newProjection(child.output ++ generatorOutput, child.output ++ generatorOutput)
val joinedRow = new JoinedRow

iter.flatMap {row =>
Expand Down

0 comments on commit efa32eb

Please sign in to comment.