You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2013/06/10 21:09:01 UTC

git commit: Fix bug where handlers would get prematurely removed before all streams completed. Updated tests to validate execution of single bit multi-fragment and two bit multi-fragment queries.

Updated Branches:
  refs/heads/execwork 5c07ccde6 -> 719c8beb7


Fix bug where handlers would get prematurely removed before all streams completed.  Updated tests to validate execution of single bit multi-fragment and two bit multi-fragment queries.


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

Branch: refs/heads/execwork
Commit: 719c8beb7d3e86e2b256950ab316e5c8526994b8
Parents: 5c07ccd
Author: Jacques Nadeau <ja...@apache.org>
Authored: Mon Jun 10 11:58:25 2013 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Mon Jun 10 12:06:36 2013 -0700

----------------------------------------------------------------------
 .../planner/fragment/SimpleParallelizer.java    | 48 ++++++++------
 .../work/batch/AbstractFragmentCollector.java   |  7 +-
 .../drill/exec/work/batch/BatchCollector.java   |  2 +-
 .../drill/exec/work/batch/IncomingBuffers.java  | 11 +++-
 .../work/foreman/RunningFragmentManager.java    |  1 +
 .../impl/TestDistributedFragmentRun.java        | 40 +++++++++++-
 .../drill/exec/pop/TestFragmentChecker.java     |  2 +-
 .../apache/drill/exec/pop/TestFragmenter.java   |  2 +-
 .../resources/physical_double_exchange.json     | 55 ++++++++++++++++
 .../test/resources/physical_simpleexchange.json | 55 ----------------
 .../resources/physical_single_exchange.json     | 57 ++++++++++------
 .../physical_single_exchange_double_entry.json  | 68 ++++++++++++++++++++
 12 files changed, 244 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java
index 8adb447..e3bcff0 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/SimpleParallelizer.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,34 +37,40 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 
+/**
+ * The simple parallelizer determines the level of parallelization of a plan based on the cost of the underlying
+ * operations.  It doesn't take into account system load or other factors.  Based on the cost of the query, the
+ * parallelization for each major fragment will be determined.  Once the amount of parallelization is done, assignment
+ * is done based on round robin assignment ordered by operator affinity (locality) to available execution Drillbits.
+ */
 public class SimpleParallelizer {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SimpleParallelizer.class);
-
   private final Materializer materializer = new Materializer();
 
   /**
    * Generate a set of assigned fragments based on the provided planningSet. Do not allow parallelization stages to go
    * beyond the global max width.
-   * 
-   * @param context
-   *          The current QueryContext.
-   * @param planningSet
-   *          The set of queries with collected statistics that we'll work with.
-   * @param globalMaxWidth
-   *          The maximum level or paralellization any stage of the query can do. Note that while this might be the
-   *          number of active Drillbits, realistically, this could be well beyond that number of we want to do things
-   *          like speed results return.
-   * @return The list of generatoe PlanFragment protobuf objects to be assigned out to the individual nodes.
-   * @throws FragmentSetupException
+   *
+   * @param foremanNode     The driving/foreman node for this query.  (this node)
+   * @param queryId         The queryId for this query.
+   * @param activeEndpoints The list of endpoints to consider for inclusion in planning this query.
+   * @param reader          Tool used to read JSON plans
+   * @param rootNode        The root node of the PhysicalPlan that we will parallelizing.
+   * @param planningSet     The set of queries with collected statistics that we'll work with.
+   * @param globalMaxWidth  The maximum level or parallelization any stage of the query can do. Note that while this
+   *                        might be the number of active Drillbits, realistically, this could be well beyond that
+   *                        number of we want to do things like speed results return.
+   * @return The list of generated PlanFragment protobuf objects to be assigned out to the individual nodes.
+   * @throws ExecutionSetupException
    */
   public QueryWorkUnit getFragments(DrillbitEndpoint foremanNode, QueryId queryId, Collection<DrillbitEndpoint> activeEndpoints, PhysicalPlanReader reader, Fragment rootNode, PlanningSet planningSet,
-      int globalMaxWidth) throws ExecutionSetupException {
+                                    int globalMaxWidth) throws ExecutionSetupException {
     assignEndpoints(activeEndpoints, planningSet, globalMaxWidth);
     return generateWorkUnit(foremanNode, queryId, reader, rootNode, planningSet);
   }
 
   private QueryWorkUnit generateWorkUnit(DrillbitEndpoint foremanNode, QueryId queryId, PhysicalPlanReader reader, Fragment rootNode,
-      PlanningSet planningSet) throws ExecutionSetupException {
+                                         PlanningSet planningSet) throws ExecutionSetupException {
 
     List<PlanFragment> fragments = Lists.newArrayList();
 
@@ -82,8 +88,8 @@ public class SimpleParallelizer {
       if (isRootNode && wrapper.getWidth() != 1)
         throw new FragmentSetupException(
             String.format(
-                    "Failure while trying to setup fragment.  The root fragment must always have parallelization one.  In the current case, the width was set to %d.",
-                    wrapper.getWidth()));
+                "Failure while trying to setup fragment.  The root fragment must always have parallelization one.  In the current case, the width was set to %d.",
+                wrapper.getWidth()));
       // a fragment is self driven if it doesn't rely on any other exchanges.
       boolean isLeafFragment = node.getReceivingExchangePairs().size() == 0;
 
@@ -92,7 +98,7 @@ public class SimpleParallelizer {
         IndexedFragmentNode iNode = new IndexedFragmentNode(minorFragmentId, wrapper);
         PhysicalOperator op = physicalOperatorRoot.accept(materializer, iNode);
         Preconditions.checkArgument(op instanceof FragmentRoot);
-        FragmentRoot root = (FragmentRoot) op; 
+        FragmentRoot root = (FragmentRoot) op;
 
         // get plan as JSON
         String plan;
@@ -101,7 +107,7 @@ public class SimpleParallelizer {
         } catch (JsonProcessingException e) {
           throw new FragmentSetupException("Failure while trying to convert fragment into json.", e);
         }
-        
+
         FragmentHandle handle = FragmentHandle //
             .newBuilder() //
             .setMajorFragmentId(wrapper.getMajorFragmentId()) //
@@ -134,7 +140,7 @@ public class SimpleParallelizer {
   }
 
   private void assignEndpoints(Collection<DrillbitEndpoint> allNodes, PlanningSet planningSet,
-      int globalMaxWidth) throws PhysicalOperatorSetupException {
+                               int globalMaxWidth) throws PhysicalOperatorSetupException {
     // First we determine the amount of parallelization for a fragment. This will be between 1 and maxWidth based on
     // cost. (Later could also be based on cluster operation.) then we decide endpoints based on affinity (later this
     // could be based on endpoint load)

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractFragmentCollector.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractFragmentCollector.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractFragmentCollector.java
index ec03392..dd55377 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractFragmentCollector.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractFragmentCollector.java
@@ -29,6 +29,7 @@ import org.apache.drill.exec.rpc.RemoteConnection.ConnectionThrottle;
 import com.google.common.base.Preconditions;
 
 public abstract class AbstractFragmentCollector implements BatchCollector{
+
   private final List<DrillbitEndpoint> incoming;
   private final int oppositeMajorFragmentId;
   private final AtomicIntegerArray remainders;
@@ -83,7 +84,11 @@ public abstract class AbstractFragmentCollector implements BatchCollector{
     return decremented;
   }
 
-  
+
+  @Override
+  public int getTotalIncomingFragments() {
+    return incoming.size();
+  }
 
   protected abstract RawBatchBuffer getBuffer(int minorFragmentId);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/BatchCollector.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/BatchCollector.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/BatchCollector.java
index b5a497e..89a889c 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/BatchCollector.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/BatchCollector.java
@@ -27,5 +27,5 @@ interface BatchCollector {
   public boolean batchArrived(ConnectionThrottle throttle, int minorFragmentId, RawFragmentBatch batch);
   public int getOppositeMajorFragmentId();
   public RawBatchBuffer[] getBuffers();
-
+  public int getTotalIncomingFragments();
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java
index 264c4b9..7f14069 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java
@@ -33,7 +33,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 /**
- * Determines when a particular fragment has enough data for each of its receiving exchanges to commence execution.
+ * Determines when a particular fragment has enough data for each of its receiving exchanges to commence execution.  Also monitors whether we've collected all incoming data.
  */
 public class IncomingBuffers {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(IncomingBuffers.class);
@@ -48,8 +48,15 @@ public class IncomingBuffers {
     root.accept(reqFrags, counts);
     
     logger.debug("Came up with a list of {} required fragments.  Fragments {}", remainingRequired.get(), counts);
-    streamsRemaining.set(remainingRequired.get());
     fragCounts = ImmutableMap.copyOf(counts);
+
+    // Determine the total number of incoming streams that will need to be completed before we are finished.
+    int totalStreams = 0;
+    for(BatchCollector bc : fragCounts.values()){
+      totalStreams += bc.getTotalIncomingFragments();
+    }
+    assert totalStreams >= remainingRequired.get() : String.format("Total Streams %d should be more than the minimum number of streams to commence (%d).  It isn't.", totalStreams, remainingRequired.get());
+    streamsRemaining.set(totalStreams);
   }
 
   public boolean batchArrived(ConnectionThrottle throttle, RawFragmentBatch batch) throws FragmentSetupException {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RunningFragmentManager.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RunningFragmentManager.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RunningFragmentManager.java
index f069db7..5bb1ff2 100644
--- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RunningFragmentManager.java
+++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RunningFragmentManager.java
@@ -96,6 +96,7 @@ class RunningFragmentManager implements FragmentStatusListener{
   }
     
   private void sendRemoteFragment(PlanFragment fragment){
+    logger.debug("Sending remote fragment to node {} with data {}", fragment.getAssignment(), fragment.getFragmentJson());
     map.put(fragment.getHandle(), new FragmentData(fragment.getHandle(), fragment.getAssignment(), false));
     FragmentSubmitListener listener = new FragmentSubmitListener(fragment.getAssignment(), fragment);
     tun.get(fragment.getAssignment()).sendFragment(listener, fragment);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
index d4147ee..9bcd84f 100644
--- a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
+++ b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDistributedFragmentRun.java
@@ -39,7 +39,7 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
   
   
   @Test 
-  public void oneBitOneExchangeRun() throws Exception{
+  public void oneBitOneExchangeOneEntryRun() throws Exception{
     RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
 
     try(Drillbit bit1 = new Drillbit(CONFIG, serviceSet); DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());){
@@ -55,4 +55,42 @@ public class TestDistributedFragmentRun extends PopUnitTestBase{
     
 
   }
+
+
+  @Test
+  public void oneBitOneExchangeTwoEntryRun() throws Exception{
+    RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
+
+    try(Drillbit bit1 = new Drillbit(CONFIG, serviceSet); DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());){
+      bit1.run();
+      client.connect();
+      List<QueryResultBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8));
+      int count = 0;
+      for(QueryResultBatch b : results){
+        count += b.getHeader().getRowCount();
+      }
+      assertEquals(200, count);
+    }
+
+
+  }
+
+  @Test
+    public void twoBitOneExchangeTwoEntryRun() throws Exception{
+      RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
+
+      try(Drillbit bit1 = new Drillbit(CONFIG, serviceSet); Drillbit bit2 = new Drillbit(CONFIG, serviceSet); DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());){
+        bit1.run();
+        bit2.run();
+        client.connect();
+        List<QueryResultBatch> results = client.runQuery(QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8));
+        int count = 0;
+      for(QueryResultBatch b : results){
+        count += b.getHeader().getRowCount();
+      }
+      assertEquals(200, count);
+    }
+
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmentChecker.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmentChecker.java b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmentChecker.java
index 710326e..ec751f1 100644
--- a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmentChecker.java
+++ b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmentChecker.java
@@ -40,7 +40,7 @@ public class TestFragmentChecker extends PopUnitTestBase{
   
   @Test
   public void checkSimpleExchangePlan() throws Exception{
-    print("/physical_simpleexchange.json", 2, 3);
+    print("/physical_double_exchange.json", 2, 3);
 
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java
index 27bee40..a4d354b 100644
--- a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java
+++ b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java
@@ -45,7 +45,7 @@ public class TestFragmenter extends PopUnitTestBase {
   @Test
   public void ensureThreeFragments() throws FragmentSetupException, IOException {
     PhysicalPlanReader ppr = new PhysicalPlanReader(CONFIG, CONFIG.getMapper(), DrillbitEndpoint.getDefaultInstance());
-    Fragment b = getRootFragment(ppr, "/physical_simpleexchange.json");
+    Fragment b = getRootFragment(ppr, "/physical_double_exchange.json");
     logger.debug("Fragment Node {}", b);
     assertEquals(3, getFragmentCount(b));
     assertEquals(1, b.getReceivingExchangePairs().size());

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/resources/physical_double_exchange.json
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/resources/physical_double_exchange.json b/sandbox/prototype/exec/java-exec/src/test/resources/physical_double_exchange.json
new file mode 100644
index 0000000..85823cf
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/test/resources/physical_double_exchange.json
@@ -0,0 +1,55 @@
+{
+    head:{
+        type:"APACHE_DRILL_PHYSICAL",
+        version:"1",
+        generator:{
+            type:"manual"
+        }
+    },
+    graph:[
+        {
+            @id:1,
+            pop:"mock-scan",
+            url: "http://apache.org",
+            entries:[
+            	{records: 100, types: [
+            	  {name: "blue", type: "INT", mode: "REQUIRED"},
+            	  {name: "red", type: "BIGINT", mode: "REQUIRED"},
+            	  {name: "green", type: "INT", mode: "REQUIRED"}
+            	]},
+            	{records: 100, types: [
+            	  {name: "blue", type: "INT", mode: "REQUIRED"},
+            	  {name: "red", type: "BIGINT", mode: "REQUIRED"},
+            	  {name: "green", type: "INT", mode: "REQUIRED"}
+            	]}
+            ]
+        },
+        {
+            @id:2,
+            pop: "hash-to-random-exchange",
+            child: 1
+        },
+        {
+            @id:3,
+            child: 2,
+            pop:"filter",
+            expr: "b > 5",
+            selectivity: 0.8
+        },
+        {
+            @id: 4,
+            child: 3,
+            pop: "mock-store"
+        },
+        {
+            @id:5,
+            child: 4,
+            pop: "union-exchange"
+        },
+        {
+            @id: 6,
+            child: 5,
+            pop: "screen"
+        }
+    ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/resources/physical_simpleexchange.json
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/resources/physical_simpleexchange.json b/sandbox/prototype/exec/java-exec/src/test/resources/physical_simpleexchange.json
deleted file mode 100644
index 85823cf..0000000
--- a/sandbox/prototype/exec/java-exec/src/test/resources/physical_simpleexchange.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
-    head:{
-        type:"APACHE_DRILL_PHYSICAL",
-        version:"1",
-        generator:{
-            type:"manual"
-        }
-    },
-    graph:[
-        {
-            @id:1,
-            pop:"mock-scan",
-            url: "http://apache.org",
-            entries:[
-            	{records: 100, types: [
-            	  {name: "blue", type: "INT", mode: "REQUIRED"},
-            	  {name: "red", type: "BIGINT", mode: "REQUIRED"},
-            	  {name: "green", type: "INT", mode: "REQUIRED"}
-            	]},
-            	{records: 100, types: [
-            	  {name: "blue", type: "INT", mode: "REQUIRED"},
-            	  {name: "red", type: "BIGINT", mode: "REQUIRED"},
-            	  {name: "green", type: "INT", mode: "REQUIRED"}
-            	]}
-            ]
-        },
-        {
-            @id:2,
-            pop: "hash-to-random-exchange",
-            child: 1
-        },
-        {
-            @id:3,
-            child: 2,
-            pop:"filter",
-            expr: "b > 5",
-            selectivity: 0.8
-        },
-        {
-            @id: 4,
-            child: 3,
-            pop: "mock-store"
-        },
-        {
-            @id:5,
-            child: 4,
-            pop: "union-exchange"
-        },
-        {
-            @id: 6,
-            child: 5,
-            pop: "screen"
-        }
-    ]
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange.json
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange.json b/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange.json
index 0e1921e..c781721 100644
--- a/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange.json
+++ b/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange.json
@@ -1,33 +1,48 @@
 {
-    head:{
-        type:"APACHE_DRILL_PHYSICAL",
-        version:"1",
-        generator:{
-            type:"manual"
+    "head": {
+        "type": "APACHE_DRILL_PHYSICAL",
+        "version": "1",
+        "generator": {
+            "type": "manual"
         }
     },
-    graph:[
+    "graph": [
         {
-            @id:1,
-            pop:"mock-scan",
-            url: "http://apache.org",
-            entries:[
-            	{records: 100, types: [
-            	  {name: "blue", type: "INT", mode: "REQUIRED"},
-            	  {name: "red", type: "BIGINT", mode: "REQUIRED"},
-            	  {name: "green", type: "INT", mode: "REQUIRED"}
-            	]}
+            "@id": 1,
+            "pop": "mock-scan",
+            "url": "http://apache.org",
+            "entries": [
+                {
+                    "records": 100,
+                    "types": [
+                        {
+                            "name": "blue",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "red",
+                            "type": "BIGINT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "green",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        }
+                    ]
+                }
             ]
         },
         {
-            @id:2,
-            child: 1,
-            pop: "union-exchange"
+            "@id": 2,
+            "child": 1,
+            "pop": "union-exchange"
         },
         {
-            @id: 3,
-            child: 2,
-            pop: "screen"
+            "@id": 3,
+            "child": 2,
+            "pop": "screen"
         }
     ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/719c8beb/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange_double_entry.json
----------------------------------------------------------------------
diff --git a/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange_double_entry.json b/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange_double_entry.json
new file mode 100644
index 0000000..4146dd0
--- /dev/null
+++ b/sandbox/prototype/exec/java-exec/src/test/resources/physical_single_exchange_double_entry.json
@@ -0,0 +1,68 @@
+{
+    "head": {
+        "type": "APACHE_DRILL_PHYSICAL",
+        "version": "1",
+        "generator": {
+            "type": "manual"
+        }
+    },
+    "graph": [
+        {
+            "@id": 1,
+            "pop": "mock-scan",
+            "url": "http://apache.org",
+            "entries": [
+                {
+                    "records": 100,
+                    "types": [
+                        {
+                            "name": "blue",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "red",
+                            "type": "BIGINT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "green",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        }
+                    ]
+                },
+                {
+                    "records": 100,
+                    "types": [
+                        {
+                            "name": "blue",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "red",
+                            "type": "BIGINT",
+                            "mode": "REQUIRED"
+                        },
+                        {
+                            "name": "green",
+                            "type": "INT",
+                            "mode": "REQUIRED"
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "@id": 2,
+            "child": 1,
+            "pop": "union-exchange"
+        },
+        {
+            "@id": 3,
+            "child": 2,
+            "pop": "screen"
+        }
+    ]
+}
\ No newline at end of file