Skip to content

Commit ec2b6c2

Browse files
yhuairxin
authored andcommitted
[SPARK-12109][SQL] Expressions's simpleString should delegate to its toString.
https://issues.apache.org/jira/browse/SPARK-12109 The change of https://issues.apache.org/jira/browse/SPARK-11596 exposed the problem. In the sql plan viz, the filter shows ![image](https://cloud.githubusercontent.com/assets/2072857/11547075/1a285230-9906-11e5-8481-2bb451e35ef1.png) After changes in this PR, the viz is back to normal. ![image](https://cloud.githubusercontent.com/assets/2072857/11547080/2bc570f4-9906-11e5-8897-3b3bff173276.png) Author: Yin Huai <[email protected]> Closes #10111 from yhuai/SPARK-12109.
1 parent ae40253 commit ec2b6c2

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,13 @@ abstract class Expression extends TreeNode[Expression] {
207207
}.toString
208208
}
209209

210-
211210
private def flatArguments = productIterator.flatMap {
212211
case t: Traversable[_] => t
213212
case single => single :: Nil
214213
}
215214

215+
override def simpleString: String = toString
216+
216217
override def toString: String = prettyName + flatArguments.mkString("(", ",", ")")
217218

218219
/**

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ case class WindowSpecDefinition(
7171
childrenResolved && checkInputDataTypes().isSuccess &&
7272
frameSpecification.isInstanceOf[SpecifiedWindowFrame]
7373

74-
75-
override def toString: String = simpleString
76-
7774
override def nullable: Boolean = true
7875
override def foldable: Boolean = false
7976
override def dataType: DataType = throw new UnsupportedOperationException

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[_] => 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)