Github user pwendell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1039#discussion_r14642915
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -1235,11 +1235,43 @@ abstract class RDD[T: ClassTag](
     
       /** A description of this RDD and its recursive dependencies for 
debugging. */
       def toDebugString: String = {
    -    def debugString(rdd: RDD[_], prefix: String = ""): Seq[String] = {
    -      Seq(prefix + rdd + " (" + rdd.partitions.size + " partitions)") ++
    -        rdd.dependencies.flatMap(d => debugString(d.rdd, prefix + "  "))
    +    // Apply a different rule to the last child
    +    def debugChildren(rdd: RDD[_], prefix: String): Seq[String] = {
    +      val len = rdd.dependencies.length
    +      len match {
    +        case 0 => Seq.empty
    +        case 1 =>
    +          val d = rdd.dependencies.head
    +          debugString(d.rdd, prefix, 
d.isInstanceOf[ShuffleDependency[_,_]], true)
    +        case _ =>
    +          val frontDeps = rdd.dependencies.take(len - 1)
    +          val endDep = rdd.dependencies.takeRight(1).head
    +          (frontDeps.flatMap(d => debugString(d.rdd, prefix, 
d.isInstanceOf[ShuffleDependency[_,_]]))
    +            ++ debugString(endDep.rdd, prefix, 
endDep.isInstanceOf[ShuffleDependency[_,_]], true))
    +      }
    +    }
    +    // The first RDD in the dependency stack has no parents, so no need 
for a +-
    +    def firstDebugString(rdd: RDD[_]): Seq[String] = {
    --- End diff --
    
    It might be good to make all these inner functions private to avoid having 
to deal with binary checker changes in the future.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to