aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAndrew Or <andrew@databricks.com>2015-05-08 17:15:10 -0700
committerAndrew Or <andrew@databricks.com>2015-05-08 17:15:10 -0700
commitbd61f07039064833108070e19b752d4c46045766 (patch)
tree439e3f0cca8250101fa4ef74a2e719f6ecd1db19 /core
parentffdc40ce7a799f2564f57b958d0f32f1d1636488 (diff)
downloadspark-bd61f07039064833108070e19b752d4c46045766.tar.gz
spark-bd61f07039064833108070e19b752d4c46045766.tar.bz2
spark-bd61f07039064833108070e19b752d4c46045766.zip
[SPARK-7469] [SQL] DAG visualization: show SQL query operators
The DAG visualization currently displays only low-level Spark primitives (e.g. `map`, `reduceByKey`, `filter` etc.). For SQL, these aren't particularly useful. Instead, we should display higher level physical operators (e.g. `Filter`, `Exchange`, `ShuffleHashJoin`). cc marmbrus ----------------- **Before** <img src="https://issues.apache.org/jira/secure/attachment/12731586/before.png" width="600px"/> ----------------- **After** (Pay attention to the words) <img src="https://issues.apache.org/jira/secure/attachment/12731587/after.png" width="600px"/> ----------------- Author: Andrew Or <andrew@databricks.com> Closes #5999 from andrewor14/dag-viz-sql and squashes the following commits: 0db23a4 [Andrew Or] Merge branch 'master' of github.com:apache/spark into dag-viz-sql 1e211db [Andrew Or] Update comment 0d49fd6 [Andrew Or] Merge branch 'master' of github.com:apache/spark into dag-viz-sql ffd237a [Andrew Or] Fix style 202dac1 [Andrew Or] Make ignoreParent false by default e61b1ab [Andrew Or] Visualize SQL operators, not low-level Spark primitives 569034a [Andrew Or] Add a flag to ignore parent settings and scopes
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala20
1 files changed, 14 insertions, 6 deletions
diff --git a/core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala b/core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala
index 9440d456ed..93ec606f2d 100644
--- a/core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala
+++ b/core/src/main/scala/org/apache/spark/rdd/RDDOperationScope.scala
@@ -102,16 +102,21 @@ private[spark] object RDDOperationScope {
/**
* Execute the given body such that all RDDs created in this body will have the same scope.
*
- * If nesting is allowed, this concatenates the previous scope with the new one in a way that
- * signifies the hierarchy. Otherwise, if nesting is not allowed, then any children calls to
- * this method executed in the body will have no effect.
+ * If nesting is allowed, any subsequent calls to this method in the given body will instantiate
+ * child scopes that are nested within our scope. Otherwise, these calls will take no effect.
+ *
+ * Additionally, the caller of this method may optionally ignore the configurations and scopes
+ * set by the higher level caller. In this case, this method will ignore the parent caller's
+ * intention to disallow nesting, and the new scope instantiated will not have a parent. This
+ * is useful for scoping physical operations in Spark SQL, for instance.
*
* Note: Return statements are NOT allowed in body.
*/
private[spark] def withScope[T](
sc: SparkContext,
name: String,
- allowNesting: Boolean)(body: => T): T = {
+ allowNesting: Boolean,
+ ignoreParent: Boolean = false)(body: => T): T = {
// Save the old scope to restore it later
val scopeKey = SparkContext.RDD_SCOPE_KEY
val noOverrideKey = SparkContext.RDD_SCOPE_NO_OVERRIDE_KEY
@@ -119,8 +124,11 @@ private[spark] object RDDOperationScope {
val oldScope = Option(oldScopeJson).map(RDDOperationScope.fromJson)
val oldNoOverride = sc.getLocalProperty(noOverrideKey)
try {
- // Set the scope only if the higher level caller allows us to do so
- if (sc.getLocalProperty(noOverrideKey) == null) {
+ if (ignoreParent) {
+ // Ignore all parent settings and scopes and start afresh with our own root scope
+ sc.setLocalProperty(scopeKey, new RDDOperationScope(name).toJson)
+ } else if (sc.getLocalProperty(noOverrideKey) == null) {
+ // Otherwise, set the scope only if the higher level caller allows us to do so
sc.setLocalProperty(scopeKey, new RDDOperationScope(name, oldScope).toJson)
}
// Optionally disallow the child body to override our scope