Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-22848][SQL] Eliminate mutable state from Stack #20035

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,15 @@ case class Stack(children: Seq[Expression]) extends Generator {

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

@kiszk kiszk Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does not use inline = true at ctx.addMutableState for correct code generation.

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ case class GenerateExec(
}
}

override def supportCodegen: Boolean = false
override def supportCodegen: Boolean = generator.supportCodegen

override def inputRDDs(): Seq[RDD[InternalRow]] = {
child.asInstanceOf[CodegenSupport].inputRDDs()
Expand Down