diff options
author | Sean Zhong <seanzhong@databricks.com> | 2016-06-02 22:45:37 -0700 |
---|---|---|
committer | Cheng Lian <lian@databricks.com> | 2016-06-02 22:45:37 -0700 |
commit | 6dde27404cb3d921d75dd6afca4b383f9df5976a (patch) | |
tree | 81501a8fb5e770507ca7602e4dfc17eb555b9598 | |
parent | 901b2e69eaf004fedfed27818072c5e70ebfaede (diff) | |
download | spark-6dde27404cb3d921d75dd6afca4b383f9df5976a.tar.gz spark-6dde27404cb3d921d75dd6afca4b383f9df5976a.tar.bz2 spark-6dde27404cb3d921d75dd6afca4b383f9df5976a.zip |
[SPARK-15733][SQL] Makes the explain output less verbose by hiding some verbose output like None, null, empty List, and etc.
## What changes were proposed in this pull request?
This PR makes the explain output less verbose by hiding some verbose output like `None`, `null`, empty List `[]`, empty set `{}`, and etc.
**Before change**:
```
== Physical Plan ==
ExecutedCommand
: +- ShowTablesCommand None, None
```
**After change**:
```
== Physical Plan ==
ExecutedCommand
: +- ShowTablesCommand
```
## How was this patch tested?
Manual test.
Author: Sean Zhong <seanzhong@databricks.com>
Closes #13470 from clockfly/verbose_breakdown_4.
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala index 3ebd815dce..50481cd298 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala @@ -427,13 +427,21 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product { private lazy val allChildren: Set[TreeNode[_]] = (children ++ innerChildren).toSet[TreeNode[_]] /** Returns a string representing the arguments to this node, minus any children */ - def argString: String = productIterator.flatMap { + def argString: String = stringArgs.flatMap { case tn: TreeNode[_] if allChildren.contains(tn) => Nil case Some(tn: TreeNode[_]) if allChildren.contains(tn) => Nil - case tn: TreeNode[_] => s"${tn.simpleString}" :: Nil - case seq: Seq[BaseType] if seq.toSet.subsetOf(children.toSet) => Nil - case seq: Seq[_] => seq.mkString("[", ",", "]") :: Nil - case set: Set[_] => set.mkString("{", ",", "}") :: Nil + case Some(tn: TreeNode[_]) => tn.simpleString :: Nil + case tn: TreeNode[_] => tn.simpleString :: Nil + case seq: Seq[Any] if seq.toSet.subsetOf(allChildren.asInstanceOf[Set[Any]]) => Nil + case iter: Iterable[_] if iter.isEmpty => Nil + case seq: Seq[_] => seq.mkString("[", ", ", "]") :: Nil + case set: Set[_] => set.mkString("{", ", ", "}") :: Nil + case array: Array[_] if array.isEmpty => Nil + case array: Array[_] => array.mkString("[", ", ", "]") :: Nil + case null => Nil + case None => Nil + case Some(null) => Nil + case Some(any) => any :: Nil case other => other :: Nil }.mkString(", ") |