Skip to content

Commit

Permalink
[GLUTEN-3854][CORE][FOLLOWUP] Add ColumnarInputAdapter back to recove…
Browse files Browse the repository at this point in the history
…r UI graph (#3933)
  • Loading branch information
ulysses-you committed Dec 6, 2023
1 parent ffd6326 commit f389b11
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ import scala.collection.JavaConverters._
* would be transformed to `ValueStreamNode` at native side.
*/
case class InputIteratorTransformer(child: SparkPlan) extends UnaryTransformSupport {
// `InputAdapter` is a case class, so `ColumnarInputAdapter.withNewChildren()` will return
// `InputAdapter`.
assert(child.isInstanceOf[InputAdapter])

@transient
override lazy val metrics: Map[String, SQLMetric] =
Expand Down Expand Up @@ -66,6 +69,17 @@ case class InputIteratorTransformer(child: SparkPlan) extends UnaryTransformSupp
}
}

/**
* InputAdapter is used to hide a SparkPlan from a subtree that supports transform. Note, if we
* remove this adaptor, the SQL UI graph would be broken.
*/
class ColumnarInputAdapter(child: SparkPlan) extends InputAdapter(child) {
// this is the most important effect of this class
override def supportCodegen: Boolean = false

override def nodeName: String = s"InputAdapter"
}

/**
* Implemented by referring to spark's CollapseCodegenStages.
*
Expand Down Expand Up @@ -153,6 +167,6 @@ object ColumnarCollapseTransformStages {
val transformStageCounter = new AtomicInteger(0)

def wrapInputIteratorTransformer(plan: SparkPlan): TransformSupport = {
InputIteratorTransformer(plan)
InputIteratorTransformer(new ColumnarInputAdapter(plan))
}
}

0 comments on commit f389b11

Please sign in to comment.