Skip to content
Snippets Groups Projects
Commit 6dde2740 authored by Sean Zhong's avatar Sean Zhong Committed by Cheng Lian
Browse files

[SPARK-15733][SQL] Makes the explain output less verbose by hiding some...

[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.
parent 901b2e69
No related branches found
No related tags found
No related merge requests found
...@@ -427,13 +427,21 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product { ...@@ -427,13 +427,21 @@ abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product {
private lazy val allChildren: Set[TreeNode[_]] = (children ++ innerChildren).toSet[TreeNode[_]] private lazy val allChildren: Set[TreeNode[_]] = (children ++ innerChildren).toSet[TreeNode[_]]
/** Returns a string representing the arguments to this node, minus any children */ /** 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 tn: TreeNode[_] if allChildren.contains(tn) => Nil
case Some(tn: TreeNode[_]) if allChildren.contains(tn) => Nil case Some(tn: TreeNode[_]) if allChildren.contains(tn) => Nil
case tn: TreeNode[_] => s"${tn.simpleString}" :: Nil case Some(tn: TreeNode[_]) => tn.simpleString :: Nil
case seq: Seq[BaseType] if seq.toSet.subsetOf(children.toSet) => Nil case tn: TreeNode[_] => tn.simpleString :: Nil
case seq: Seq[_] => seq.mkString("[", ",", "]") :: Nil case seq: Seq[Any] if seq.toSet.subsetOf(allChildren.asInstanceOf[Set[Any]]) => Nil
case set: Set[_] => set.mkString("{", ",", "}") :: 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 case other => other :: Nil
}.mkString(", ") }.mkString(", ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment