Skip to content

Commit

Permalink
Fix the cases where operators set up its produce framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Aug 14, 2017
1 parent 4bef567 commit 1694c9b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ case class SortExec(
""".stripMargin.trim
}

override protected def effectiveContinueStatement: String = "continue;"
override protected def isConsumeInSeparateFunc: Boolean = false

protected override val shouldStopRequired = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ trait CodegenSupport extends SparkPlan {
* ... // logic of Op2Exec to consume rows.
* }
* For now, `isConsumeInSeparateFunc` of Op2Exec will be `true`.
*
* Notice for some operators like `HashAggregateExec`, it doesn't chain previous consume functions
* but begins with its produce framework. We should override `isConsumeInSeparateFunc` to return
* `false`.
*/
protected def isConsumeInSeparateFunc: Boolean = {
val codegenChildren = children.map(_.asInstanceOf[CodegenSupport])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ case class HashAggregateExec(
// The variables used as aggregation buffer. Only used for aggregation without keys.
private var bufVars: Seq[ExprCode] = _

override protected def effectiveContinueStatement: String = "continue;"
override protected def isConsumeInSeparateFunc: Boolean = false

private def doProduceWithoutKeys(ctx: CodegenContext): String = {
val initAgg = ctx.freshName("initAgg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ case class SortMergeJoinExec(
}
}

override protected def isConsumeInSeparateFunc: Boolean = false

override def doProduce(ctx: CodegenContext): String = {
ctx.copyResult = true
val leftInput = ctx.freshName("leftInput")
Expand Down

0 comments on commit 1694c9b

Please sign in to comment.