Skip to content

Commit 1b3db96

Browse files
yhuaimarmbrus
authored andcommitted
[SPARK-11596][SQL] In TreeNode's argString, if a TreeNode is not a child of the current TreeNode, we should only return the simpleString.
In TreeNode's argString, if a TreeNode is not a child of the current TreeNode, we will only return the simpleString. I tested the [following case provided by Cristian](https://issues.apache.org/jira/browse/SPARK-11596?focusedCommentId=15019241&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15019241). ``` val c = (1 to 20).foldLeft[Option[DataFrame]] (None) { (curr, idx) => println(s"PROCESSING >>>>>>>>>>> $idx") val df = sqlContext.sparkContext.parallelize((0 to 10).zipWithIndex).toDF("A", "B") val union = curr.map(_.unionAll(df)).getOrElse(df) union.cache() Some(union) } c.get.explain(true) ``` Without the change, `c.get.explain(true)` took 100s. With the change, `c.get.explain(true)` took 26ms. https://issues.apache.org/jira/browse/SPARK-11596 Author: Yin Huai <yhuai@databricks.com> Closes apache#10079 from yhuai/SPARK-11596. (cherry picked from commit e96a70d) Signed-off-by: Michael Armbrust <michael@databricks.com>
1 parent 14eadf9 commit 1b3db96

File tree

1 file changed

+1
-1
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees

1 file changed

+1
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product {
380380
/** Returns a string representing the arguments to this node, minus any children */
381381
def argString: String = productIterator.flatMap {
382382
case tn: TreeNode[_] if containsChild(tn) => Nil
383-
case tn: TreeNode[_] if tn.toString contains "\n" => s"(${tn.simpleString})" :: Nil
383+
case tn: TreeNode[_] => s"(${tn.simpleString})" :: Nil
384384
case seq: Seq[BaseType] if seq.toSet.subsetOf(children.toSet) => Nil
385385
case seq: Seq[_] => seq.mkString("[", ",", "]") :: Nil
386386
case set: Set[_] => set.mkString("{", ",", "}") :: Nil

0 commit comments

Comments
 (0)