flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetz...@apache.org
Subject [15/15] git commit: Fixed JSON Bug for some plans.
Date Wed, 18 Jun 2014 12:00:35 GMT
Fixed JSON Bug for some plans.

Signed-off-by: Robert Metzger <metzgerr@web.de>

This closes #23.


Project: http://git-wip-us.apache.org/repos/asf/incubator-flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-flink/commit/b692b049
Tree: http://git-wip-us.apache.org/repos/asf/incubator-flink/tree/b692b049
Diff: http://git-wip-us.apache.org/repos/asf/incubator-flink/diff/b692b049

Branch: refs/heads/master
Commit: b692b0496d86db352607a489f8a018fcb32ff4de
Parents: 5484d58
Author: Jonathan <Jonathan@Hasenburg.de>
Authored: Tue Jun 17 14:08:27 2014 +0200
Committer: Robert Metzger <metzgerr@web.de>
Committed: Wed Jun 18 12:17:04 2014 +0200

----------------------------------------------------------------------
 .../compiler/plandump/PlanJSONDumpGenerator.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/b692b049/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/plandump/PlanJSONDumpGenerator.java
----------------------------------------------------------------------
diff --git a/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/plandump/PlanJSONDumpGenerator.java
b/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/plandump/PlanJSONDumpGenerator.java
index 83cb502..82d757c 100644
--- a/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/plandump/PlanJSONDumpGenerator.java
+++ b/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/plandump/PlanJSONDumpGenerator.java
@@ -132,10 +132,10 @@ public class PlanJSONDumpGenerator {
 		writer.println("\n\t]\n}");
 	}
 
-	private void visit(DumpableNode<?> node, PrintWriter writer, boolean first) {
+	private boolean visit(DumpableNode<?> node, PrintWriter writer, boolean first) {
 		// check for duplicate traversal
 		if (this.nodeIds.containsKey(node)) {
-			return;
+			return false;
 		}
 		
 		// assign an id first
@@ -143,8 +143,11 @@ public class PlanJSONDumpGenerator {
 		
 		// then recurse
 		for (DumpableNode<?> child : node.getPredecessors()) {
-			visit(child, writer, first);
-			first = false;
+			//This is important, because when the node was already in the graph it is not allowed
+			//to set first to false!
+			if (visit(child, writer, first)) {
+				first = false;
+			};
 		}
 		
 		// check if this node should be skipped from the dump
@@ -153,7 +156,7 @@ public class PlanJSONDumpGenerator {
 		// ------------------ dump after the ascend ---------------------
 		// start a new node and output node id
 		if (!first) {
-			writer.print(",\n");
+			writer.print(",\n");	
 		}
 		// open the node
 		writer.print("\t{\n");
@@ -385,7 +388,7 @@ public class PlanJSONDumpGenerator {
 		if (p == null) {
 			// finish node
 			writer.print("\n\t}");
-			return;
+			return true;
 		}
 		// local strategy
 		String locString = null;
@@ -579,6 +582,7 @@ public class PlanJSONDumpGenerator {
 
 		// finish node
 		writer.print("\n\t}");
+		return true;
 	}
 
 	private void addProperty(PrintWriter writer, String name, String value, boolean first) {


Mime
View raw message