Skip to content

Commit 9d5375e

Browse files
authored
Merge pull request #541 from juripetersen/explain-json-in-dataquanta
Add default toJson argument for explain
2 parents 35be199 + a9c4ba9 commit 9d5375e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

wayang-api/wayang-api-scala-java/src/main/scala/org/apache/wayang/api/DataQuanta.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ class DataQuanta[Out: ClassTag](val operator: ElementaryOperator, outputIndex: I
942942
collector
943943
}
944944

945-
def explain(): Unit = {
945+
def explain(toJson: Boolean = false): Unit = {
946946
// Set up the sink.
947947
val collector = new java.util.LinkedList[Out]()
948948
val sink = LocalCallbackSink.createCollectingSink(collector, dataSetType[Out])
@@ -951,7 +951,7 @@ class DataQuanta[Out: ClassTag](val operator: ElementaryOperator, outputIndex: I
951951

952952
// Do the explanation.
953953
this.planBuilder.sinks += sink
954-
this.planBuilder.buildAndExplain()
954+
this.planBuilder.buildAndExplain(toJson)
955955
}
956956

957957

wayang-api/wayang-api-scala-java/src/main/scala/org/apache/wayang/api/PlanBuilder.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ class PlanBuilder(private[api] val wayangContext: WayangContext, private var job
109109
/**
110110
* Build the [[org.apache.wayang.core.api.Job]] and explain it.
111111
*/
112-
def buildAndExplain(): Unit = {
112+
def buildAndExplain(toJson: Boolean = false): Unit = {
113113
val plan: WayangPlan = new WayangPlan(this.sinks.toArray: _*)
114-
this.wayangContext.explain(plan, this.udfJars.toArray: _*)
114+
if (toJson) {
115+
this.wayangContext.explain(plan, toJson, this.udfJars.toArray: _*)
116+
} else {
117+
this.wayangContext.explain(plan, this.udfJars.toArray: _*)
118+
}
115119
}
116120

117121
/**

0 commit comments

Comments
 (0)