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 2014/05/12 04:48:27 UTC

[05/10] Add support for RepeatedMapVector, MapVector and RepeatedListVector.

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
index 3fff0e4..c1452cd 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java
@@ -62,14 +62,14 @@ public class ExpressionTest extends ExecTest {
 
   @Test
   public void testSpecial(final @Injectable RecordBatch batch, @Injectable ValueVector vector) throws Exception {
-    final TypedFieldId tfid = new TypedFieldId(Types.optional(MinorType.INT),0, false);
+    final TypedFieldId tfid = new TypedFieldId(Types.optional(MinorType.INT), false, 0);
 
     new NonStrictExpectations() {
       @NonStrict VectorWrapper<?> wrapper;
       {
         batch.getValueVectorId(new SchemaPath("alpha", ExpressionPosition.UNKNOWN));
         result = tfid;
-        batch.getValueAccessorById(tfid.getFieldId(), IntVector.class);
+        batch.getValueAccessorById(IntVector.class, tfid.getFieldIds());
         result = wrapper;
         wrapper.getValueVector();
         result = new IntVector(null, null);
@@ -81,7 +81,7 @@ public class ExpressionTest extends ExecTest {
 
   @Test
   public void testSchemaExpression(final @Injectable RecordBatch batch) throws Exception {
-    final TypedFieldId tfid = new TypedFieldId(Types.optional(MinorType.BIGINT), 0, false);
+    final TypedFieldId tfid = new TypedFieldId(Types.optional(MinorType.BIGINT), false, 0);
 
     new Expectations() {
       {

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
index 92c49b9..a2ba851 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
@@ -34,7 +34,7 @@ import org.junit.Test;
 
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class TestDateFunctions extends PopUnitTestBase {
     static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestDateFunctions.class);
@@ -62,7 +62,7 @@ public class TestDateFunctions extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
                 System.out.println(accessor.getObject(0));
-                assertTrue((accessor.getObject(0)).toString().equals(expectedResults[i++]));
+                assertEquals( expectedResults[i++], accessor.getObject(0).toString());
             }
 
             batchLoader.clear();
@@ -74,49 +74,49 @@ public class TestDateFunctions extends PopUnitTestBase {
 
     @Test
     public void testDateIntervalArithmetic() throws Exception {
-        String expectedResults[] = {"2009-02-23",
-                                    "2008-02-24",
-                                    "13:20:33",
-                                    "2008-02-24 12:00:00.0",
-                                    "2009-04-23 12:00:00.0",
-                                    "2008-02-24 12:00:00.0",
-                                    "2009-04-23 12:00:00.0",
-                                    "2009-02-23",
-                                    "2008-02-24",
-                                    "13:20:33",
-                                    "2008-02-24 12:00:00.0",
-                                    "2009-04-23 12:00:00.0",
-                                    "2008-02-24 12:00:00.0",
-                                    "2009-04-23 12:00:00.0"};
-
+        String expectedResults[] = {"2009-02-23T00:00:00.000-08:00",
+                                    "2008-02-24T00:00:00.000-08:00",
+                                    "1970-01-01T13:20:33.000-08:00",
+                                    "2008-02-24T12:00:00.000-08:00",
+                                    "2009-04-23T12:00:00.000-07:00",
+                                    "2008-02-24T12:00:00.000-08:00",
+                                    "2009-04-23T12:00:00.000-07:00",
+                                    "2009-02-23T00:00:00.000-08:00",
+                                    "2008-02-24T00:00:00.000-08:00",
+                                    "1970-01-01T13:20:33.000-08:00",
+                                    "2008-02-24T12:00:00.000-08:00",
+                                    "2009-04-23T12:00:00.000-07:00",
+                                    "2008-02-24T12:00:00.000-08:00",
+                                    "2009-04-23T12:00:00.000-07:00"};
         testCommon(expectedResults, "/functions/date/date_interval_arithmetic.json", "/test_simple_date.json");
     }
 
     @Test
     public void testDateDifferenceArithmetic() throws Exception {
 
-        String[] expectedResults = {"365 days 0:0:0.0",
-                                   "-366 days 0:-1:0.0",
-                                    "0 days 3:0:0.0",
-                                    "0 days 11:0:0.0"};
+        String[] expectedResults = {"P365D",
+                                    "P-366DT-60S",
+                                    "PT10800S",
+                                    "PT39600S"};
         testCommon(expectedResults, "/functions/date/date_difference_arithmetic.json", "/test_simple_date.json");
     }
 
     @Test
     public void testIntervalArithmetic() throws Exception {
 
-        String[] expectedResults = {"2 years 2 months ",
-                                    "2 days 1:2:3.0",
-                                    "0 years 2 months ",
-                                    "0 days 1:2:3.0",
-                                    "2 years 4 months 0 days 0:0:0.0",
-                                    "0 years 0 months 0 days 2:0:6.0",
-                                    "0 years 7 months 0 days 0:0:0.0",
-                                    "0 years 0 months 0 days 0:30:1.500",
-                                    "2 years 9 months 18 days 0:0:0.0",
-                                    "0 years 0 months 0 days 2:24:7.200",
-                                    "0 years 6 months 19 days 23:59:59.999",
-                                    "0 years 0 months 0 days 0:28:35.714"};
+      String expectedResults[] = {"P2Y2M",
+          "P2DT3723S",
+          "P2M",
+          "PT3723S",
+          "P28M",
+          "PT7206S",
+          "P7M",
+          "PT1801.500S",
+          "P33M18D",
+          "PT8647.200S",
+          "P6M19DT86399.999S",
+          "PT1715.714S"};
+
         testCommon(expectedResults, "/functions/date/interval_arithmetic.json", "/test_simple_date.json");
     }
 
@@ -132,10 +132,10 @@ public class TestDateFunctions extends PopUnitTestBase {
 
     @Test
     public void testToDateType() throws Exception {
-        String expectedResults[] = {"2008-02-23",
-                                    "12:20:30",
-                                    "2008-02-23 12:00:00.0",
-                                    "2008-02-23 12:00:00.0"};
+        String expectedResults[] = {"2008-02-23T00:00:00.000-08:00",
+                                    "1970-01-01T12:20:30.000-08:00",
+                                    "2008-02-23T12:00:00.000-08:00",
+                                    "2008-02-23T12:00:00.000-08:00"};
 
         testCommon(expectedResults, "/functions/date/to_date_type.json", "/test_simple_date.json");
     }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java
index c3f68fd..62f9a21 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java
@@ -63,7 +63,7 @@ public class SimpleRootExec implements RootExec, Iterable<ValueVector>{
   @SuppressWarnings("unchecked")
   public <T extends ValueVector> T getValueVectorById(SchemaPath path, Class<?> vvClass){
     TypedFieldId tfid = incoming.getValueVectorId(path);
-    return (T) incoming.getValueAccessorById(tfid.getFieldId(), vvClass).getValueVector();
+    return (T) incoming.getValueAccessorById(vvClass, tfid.getFieldIds()).getValueVector();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
index bcf7e69..402df63 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
@@ -451,7 +451,7 @@ public class TestCastFunctions extends PopUnitTestBase{
 
       for (int i = 0; i<result.length; i++ ) {
         for (int j = 0; j<result[0].length; j++) {
-          assertEquals(String.format("Column %s at row %s have wrong result",  j, i), result[i][j], expected[i][j]);
+          assertEquals(String.format("Column %s at row %s have wrong result",  j, i), result[i][j].toString(), expected[i][j]);
         }
       }
       batchLoader.clear();

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
index 9a88912..d48f91f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestConvertFunctions.java
@@ -25,9 +25,7 @@ import static org.junit.Assert.fail;
 import io.netty.buffer.ByteBuf;
 
 import java.text.DateFormat;
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 
 import mockit.Injectable;
@@ -36,6 +34,7 @@ import mockit.NonStrictExpectations;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
+import org.apache.drill.exec.expr.fn.impl.DateUtility;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.ops.FragmentContext;
@@ -58,6 +57,7 @@ import org.apache.drill.exec.util.VectorUtil;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.exec.vector.VarCharVector;
 import org.junit.Test;
+import org.joda.time.DateTime;
 
 import com.codahale.metrics.MetricRegistry;
 import com.google.common.base.Charsets;
@@ -71,24 +71,12 @@ public class TestConvertFunctions extends PopUnitTestBase {
 
   private static final float DELTA = (float) 0.0001;
 
-  private static final DateFormat DATE_FORMAT;
-  private static final DateFormat DATE_TIME_FORMAT;
-
   // "1980-01-01 01:23:45.678"
   private static final String DATE_TIME_BE = "\\x00\\x00\\x00\\x49\\x77\\x85\\x1f\\x8e";
   private static final String DATE_TIME_LE = "\\x8e\\x1f\\x85\\x77\\x49\\x00\\x00\\x00";
 
-  private static Date time = null;
-  private static Date date = null;
-
-  static {
-    DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
-    DATE_TIME_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS");
-    try {
-      time = DATE_TIME_FORMAT.parse("01:23:45.678"); // 5025678
-      date = DATE_FORMAT.parse("1980-01-01"); // 0x4977387000
-    } catch (ParseException e) { }
-  }
+  private static DateTime time = DateTime.parse("01:23:45.678", DateUtility.getTimeFormatter());
+  private static DateTime date = DateTime.parse("1980-01-01", DateUtility.getDateTimeFormatter());
 
   DrillConfig c = DrillConfig.create();
   PhysicalPlanReader reader;
@@ -99,7 +87,7 @@ public class TestConvertFunctions extends PopUnitTestBase {
   @Test
   public void testDateTime1(@Injectable final DrillbitContext bitContext,
       @Injectable UserServer.UserClientConnection connection) throws Throwable {
-    runTest(bitContext, connection, "convert_from(binary_string('" + DATE_TIME_BE + "'), 'TIME_EPOCH_BE')", time);
+    runTest(bitContext, connection, "(convert_from(binary_string('" + DATE_TIME_BE + "'), 'TIME_EPOCH_BE'))", time);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
index 48600a0..79f7b24 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java
@@ -80,8 +80,8 @@ public class TestDecimal extends PopUnitTestBase{
 
 
             for (int i = 0; i < dec9Accessor.getValueCount(); i++) {
-                assertEquals(dec9Accessor.getObject(i), decimal9Output[i]);
-                assertEquals(dec18Accessor.getObject(i), decimal18Output[i]);
+                assertEquals(dec9Accessor.getObject(i).toString(), decimal9Output[i]);
+                assertEquals(dec18Accessor.getObject(i).toString(), decimal18Output[i]);
             }
             assertEquals(6, dec9Accessor.getValueCount());
             assertEquals(6, dec18Accessor.getValueCount());
@@ -161,9 +161,9 @@ public class TestDecimal extends PopUnitTestBase{
             ValueVector.Accessor mulAccessor = itr.next().getValueVector().getAccessor();
 
             for (int i = 0; i < addAccessor.getValueCount(); i++) {
-                assertEquals(addAccessor.getObject(i), addOutput[i]);
-                assertEquals(subAccessor.getObject(i), subtractOutput[i]);
-                assertEquals(mulAccessor.getObject(i), multiplyOutput[i]);
+                assertEquals(addAccessor.getObject(i).toString(), addOutput[i]);
+                assertEquals(subAccessor.getObject(i).toString(), subtractOutput[i]);
+                assertEquals(mulAccessor.getObject(i).toString(), multiplyOutput[i]);
 
             }
             assertEquals(6, addAccessor.getValueCount());
@@ -206,9 +206,9 @@ public class TestDecimal extends PopUnitTestBase{
             ValueVector.Accessor mulAccessor = itr.next().getValueVector().getAccessor();
 
             for (int i = 0; i < addAccessor.getValueCount(); i++) {
-                assertEquals(addAccessor.getObject(i), addOutput[i]);
-                assertEquals(subAccessor.getObject(i), subtractOutput[i]);
-                assertEquals(mulAccessor.getObject(i), multiplyOutput[i]);
+                assertEquals(addAccessor.getObject(i).toString(), addOutput[i]);
+                assertEquals(subAccessor.getObject(i).toString(), subtractOutput[i]);
+                assertEquals(mulAccessor.getObject(i).toString(), multiplyOutput[i]);
             }
             assertEquals(7, addAccessor.getValueCount());
             assertEquals(7, subAccessor.getValueCount());
@@ -255,7 +255,7 @@ public class TestDecimal extends PopUnitTestBase{
             ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
             for (int i = 0; i < accessor.getValueCount(); i++) {
-                assertEquals(sortOutput[i], accessor.getObject(i));
+                assertEquals(sortOutput[i], accessor.getObject(i).toString());
             }
             assertEquals(10, accessor.getValueCount());
         }
@@ -293,7 +293,7 @@ public class TestDecimal extends PopUnitTestBase{
             ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
             for (int i = 0; i < accessor.getValueCount(); i++) {
-                assertEquals(accessor.getObject(i), sortOutput[i]);
+                assertEquals(accessor.getObject(i).toString(), sortOutput[i]);
             }
             assertEquals(7, accessor.getValueCount());
         }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
index 74f1698..a4f10d0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestExtractFunctions.java
@@ -126,7 +126,7 @@ public class TestExtractFunctions extends PopUnitTestBase {
       for(int i=0; i<expectedValues.length; i++) {
         for(int j=0; j<expectedValues[i].length; j++) {
           NullableBigIntVector vv =
-              (NullableBigIntVector) batchLoader.getValueAccessorById(j, NullableBigIntVector.class).getValueVector();
+              (NullableBigIntVector) batchLoader.getValueAccessorById(NullableBigIntVector.class, j).getValueVector();
           System.out.println("["+i+"]["+j+"]: Expected: " + expectedValues[i][j] + ", Actual: " + vv.getAccessor().get(i));
           assertEquals(expectedValues[i][j], vv.getAccessor().get(i));
         }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java
index 4a849d1..adfd9bc 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java
@@ -135,8 +135,8 @@ public class TestImplicitCastFunctions extends ExecTest {
     Object [] expected = new Object[5];
     expected [0] = new Integer (0);
     expected [1] = new Integer (0);
-    expected [2] = new Float (-4.2949673E9);
-    expected [3] = new Float (-4.2949673E9);
+    expected [2] = new Float (-2.14748365E9);
+    expected [3] = new Float (-2.14748365E9);
     expected [4] = new Double (-9.223372036854776E18);
 
     runTest(bitContext, connection, expected, "functions/cast/testICastMockCol.json");

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
index a0b77a5..9285501 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java
@@ -71,7 +71,7 @@ public class TestReverseImplicitCast extends PopUnitTestBase {
         System.out.println(intAccessor1.getObject(i));
         assertEquals(intAccessor1.getObject(i), 10);
         System.out.println(varcharAccessor1.getObject(i));
-        assertEquals(varcharAccessor1.getObject(i), "101");
+        assertEquals(varcharAccessor1.getObject(i).toString(), "101");
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java
index 25b62ad..7ff165b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java
@@ -92,7 +92,7 @@ public class TestSimpleTopN extends PopUnitTestBase {
         batchCount++;
         RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
         loader.load(b.getHeader().getDef(),b.getData());
-        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldId(), BigIntVector.class).getValueVector();
+        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
 
 
         BigIntVector.Accessor a1 = c1.getAccessor();

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
index 927319a..ecfc10a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestAgg.java
@@ -81,8 +81,8 @@ public class TestAgg extends ExecTest {
       int[] keyArr = {Integer.MIN_VALUE, Integer.MAX_VALUE};
 
       for(int i =0; i < exec.getRecordCount(); i++){
-        assertEquals(cntArr[i], cnt.getAccessor().getObject(i));
-        assertEquals(keyArr[i], key.getAccessor().getObject(i));
+        assertEquals((Long) cntArr[i], cnt.getAccessor().getObject(i));
+        assertEquals((Integer) keyArr[i], key.getAccessor().getObject(i));
       }
     }
 
@@ -102,7 +102,7 @@ public class TestAgg extends ExecTest {
       BigIntVector key2 = exec.getValueVectorById(SchemaPath.getSimplePath("key2"), BigIntVector.class);
       BigIntVector cnt = exec.getValueVectorById(SchemaPath.getSimplePath("cnt"), BigIntVector.class);
       BigIntVector total = exec.getValueVectorById(SchemaPath.getSimplePath("total"), BigIntVector.class);
-      int[] keyArr1 = {Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE};
+      Integer[] keyArr1 = {Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE};
       long[] keyArr2 = {0,1,2,0,1,2};
       long[] cntArr = {34,34,34,34,34,34};
       long[] totalArr = {0,34,68,0,34,68};
@@ -116,10 +116,10 @@ public class TestAgg extends ExecTest {
 //        System.out.print("\t");
 //        System.out.print(total.getAccessor().getObject(i));
 //        System.out.println();
-        assertEquals(cntArr[i], cnt.getAccessor().getObject(i));
+        assertEquals((Long) cntArr[i], cnt.getAccessor().getObject(i));
         assertEquals(keyArr1[i], key1.getAccessor().getObject(i));
-        assertEquals(keyArr2[i], key2.getAccessor().getObject(i));
-        assertEquals(totalArr[i], total.getAccessor().getObject(i));
+        assertEquals((Long) keyArr2[i], key2.getAccessor().getObject(i));
+        assertEquals((Long) totalArr[i], total.getAccessor().getObject(i));
       }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
index 06d8a32..25af66d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
@@ -68,6 +68,7 @@ public class TestMergeJoin extends PopUnitTestBase {
   DrillConfig c = DrillConfig.create();
 
   @Test
+  @Ignore // this doesn't have a sort.  it also causes an infinite loop.  these may or may not be related.
   public void simpleEqualityJoin(@Injectable final DrillbitContext bitContext,
                                  @Injectable UserServer.UserClientConnection connection) throws Throwable {
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
index 699f075..136b7c1 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java
@@ -81,12 +81,12 @@ public class TestOrderedPartitionExchange extends PopUnitTestBase {
           count += rows;
           RecordBatchLoader loader = new RecordBatchLoader(new BootStrapContext(DrillConfig.create()).getAllocator());
           loader.load(b.getHeader().getDef(), b.getData());
-          BigIntVector vv1 = (BigIntVector)loader.getValueAccessorById(loader.getValueVectorId(
-                  new SchemaPath("col1", ExpressionPosition.UNKNOWN)).getFieldId(), BigIntVector.class).getValueVector();
-          Float8Vector vv2 = (Float8Vector)loader.getValueAccessorById(loader.getValueVectorId(
-                  new SchemaPath("col2", ExpressionPosition.UNKNOWN)).getFieldId(), Float8Vector.class).getValueVector();
-          IntVector pVector = (IntVector)loader.getValueAccessorById(loader.getValueVectorId(
-                  new SchemaPath("partition", ExpressionPosition.UNKNOWN)).getFieldId(), IntVector.class).getValueVector();
+          BigIntVector vv1 = (BigIntVector)loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(
+                  new SchemaPath("col1", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
+          Float8Vector vv2 = (Float8Vector)loader.getValueAccessorById(Float8Vector.class, loader.getValueVectorId(
+                  new SchemaPath("col2", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
+          IntVector pVector = (IntVector)loader.getValueAccessorById(IntVector.class, loader.getValueVectorId(
+                  new SchemaPath("partition", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
           long previous1 = Long.MIN_VALUE;
           double previous2 = Double.MIN_VALUE;
           int partPrevious = -1;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
index 6ddb73d..c8261aa 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java
@@ -66,8 +66,8 @@ public class TestWriter extends BaseTestQuery {
     QueryResultBatch batch = results.get(0);
     assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData()));
 
-    VarCharVector fragmentIdV = (VarCharVector) batchLoader.getValueAccessorById(0, VarCharVector.class).getValueVector();
-    BigIntVector recordWrittenV = (BigIntVector) batchLoader.getValueAccessorById(1, BigIntVector.class).getValueVector();
+    VarCharVector fragmentIdV = (VarCharVector) batchLoader.getValueAccessorById(VarCharVector.class, 0).getValueVector();
+    BigIntVector recordWrittenV = (BigIntVector) batchLoader.getValueAccessorById(BigIntVector.class, 1).getValueVector();
 
     // expected only one row in output
     assertEquals(1, batchLoader.getRecordCount());
@@ -137,7 +137,7 @@ public class TestWriter extends BaseTestQuery {
       if (batchLoader.getRecordCount() <= 0)
         continue;
 
-      BigIntVector recordWrittenV = (BigIntVector) batchLoader.getValueAccessorById(1, BigIntVector.class).getValueVector();
+      BigIntVector recordWrittenV = (BigIntVector) batchLoader.getValueAccessorById(BigIntVector.class, 1).getValueVector();
 
       for (int i = 0; i < batchLoader.getRecordCount(); i++) {
         recordsWritten += recordWrittenV.getAccessor().get(i);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestSimpleExternalSort.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestSimpleExternalSort.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestSimpleExternalSort.java
index 5de0ad7..df123e7 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestSimpleExternalSort.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestSimpleExternalSort.java
@@ -74,7 +74,7 @@ public class TestSimpleExternalSort extends PopUnitTestBase {
         batchCount++;
         RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
         loader.load(b.getHeader().getDef(),b.getData());
-        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldId(), BigIntVector.class).getValueVector();
+        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
 
 
         BigIntVector.Accessor a1 = c1.getAccessor();
@@ -127,7 +127,7 @@ public class TestSimpleExternalSort extends PopUnitTestBase {
         batchCount++;
         RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
         loader.load(b.getHeader().getDef(),b.getData());
-        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldId(), BigIntVector.class).getValueVector();
+        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
 
 
         BigIntVector.Accessor a1 = c1.getAccessor();
@@ -177,7 +177,7 @@ public class TestSimpleExternalSort extends PopUnitTestBase {
         batchCount++;
         RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
         loader.load(b.getHeader().getDef(),b.getData());
-        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldId(), BigIntVector.class).getValueVector();
+        BigIntVector c1 = (BigIntVector) loader.getValueAccessorById(BigIntVector.class, loader.getValueVectorId(new SchemaPath("blue", ExpressionPosition.UNKNOWN)).getFieldIds()).getValueVector();
 
 
         BigIntVector.Accessor a1 = c1.getAccessor();

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
index 78fb1c1..8a31a27 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
@@ -41,8 +41,6 @@ import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.expr.ExpressionTreeMaterializer;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
-import org.apache.drill.exec.proto.SchemaDefProtos.FieldDef;
-import org.apache.drill.exec.proto.SchemaDefProtos.NamePart;
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableList;
@@ -60,8 +58,7 @@ public class ExpressionTreeMaterializerTest extends ExecTest {
   FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
 
   private MaterializedField getField(int fieldId, String name, MajorType type) {
-    return new MaterializedField(FieldDef.newBuilder().setMajorType(type).addName(NamePart.newBuilder().setName(name))
-        .build());
+    return MaterializedField.create(SchemaPath.getSimplePath(name), type);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
index 5d6a37f..661cf67 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
@@ -93,9 +93,9 @@ public class TestDateTypes extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
-                assertTrue((accessor.getObject(0)).equals("1970-01-02"));
-                assertTrue((accessor.getObject(1)).equals("2008-12-28"));
-                assertTrue((accessor.getObject(2)).equals("2000-02-27"));
+                assertEquals((accessor.getObject(0).toString()), ("1970-01-02"));
+                assertEquals((accessor.getObject(1).toString()), ("2008-12-28"));
+                assertEquals((accessor.getObject(2).toString()), ("2000-02-27"));
             }
 
             batchLoader.clear();
@@ -127,9 +127,9 @@ public class TestDateTypes extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
-                assertEquals((accessor.getObject(0)), new String("1970-01-02"));
-                assertEquals((accessor.getObject(1)), new String("2000-02-27"));
-                assertEquals((accessor.getObject(2)), new String("2008-12-28"));
+                assertEquals((accessor.getObject(0).toString()), new String("1970-01-02"));
+                assertEquals((accessor.getObject(1).toString()), new String("2000-02-27"));
+                assertEquals((accessor.getObject(2).toString()), new String("2008-12-28"));
             }
 
             batchLoader.clear();
@@ -161,9 +161,9 @@ public class TestDateTypes extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
-                assertTrue(accessor.getObject(0).equals("1970-01-02 10:20:33.000"));
-                assertTrue((accessor.getObject(1)).equals("2008-12-28 11:34:00.129"));
-                assertTrue((accessor.getObject(2)).equals("2000-02-27 14:24:00.000"));
+                assertEquals(accessor.getObject(0).toString() ,"1970-01-02 10:20:33.000");
+                assertEquals(accessor.getObject(1).toString() ,"2008-12-28 11:34:00.129");
+                assertEquals(accessor.getObject(2).toString(), "2000-02-27 14:24:00.000");
             }
 
             batchLoader.clear();
@@ -196,32 +196,33 @@ public class TestDateTypes extends PopUnitTestBase {
             ValueVector.Accessor accessor = itr.next().getValueVector().getAccessor();
 
             // Check the interval type
-            assertTrue((accessor.getObject(0)).equals("2 years 2 months 1 day 1:20:35.0"));
-            assertTrue((accessor.getObject(1)).equals("2 years 2 months 0 days 0:0:0.0"));
-            assertTrue((accessor.getObject(2)).equals("0 years 0 months 0 days 1:20:35.0"));
-            assertTrue((accessor.getObject(3)).equals("2 years 2 months 1 day 1:20:35.897"));
-            assertTrue((accessor.getObject(4)).equals("0 years 0 months 0 days 0:0:35.4"));
-            assertTrue((accessor.getObject(5)).equals("1 year 10 months 1 day 0:-39:-25.0"));
+            assertEquals((accessor.getObject(0).toString()), ("2 years 2 months 1 day 1:20:35.0"));
+            assertEquals((accessor.getObject(1).toString()), ("2 years 2 months 0 days 0:0:0.0"));
+            assertEquals((accessor.getObject(2).toString()), ("0 years 0 months 0 days 1:20:35.0"));
+            assertEquals((accessor.getObject(3).toString()),("2 years 2 months 1 day 1:20:35.897"));
+            assertEquals((accessor.getObject(4).toString()), ("0 years 0 months 0 days 0:0:35.4"));
+            assertEquals((accessor.getObject(5).toString()), ("1 year 10 months 1 day 0:-39:-25.0"));
 
             accessor = itr.next().getValueVector().getAccessor();
 
             // Check the interval year type
-            assertTrue((accessor.getObject(0)).equals("2 years 2 months "));
-            assertTrue((accessor.getObject(1)).equals("2 years 2 months "));
-            assertTrue((accessor.getObject(2)).equals("0 years 0 months "));
-            assertTrue((accessor.getObject(3)).equals("2 years 2 months "));
-            assertTrue((accessor.getObject(4)).equals("0 years 0 months "));
-            assertTrue((accessor.getObject(5)).equals("1 year 10 months "));
+            assertEquals((accessor.getObject(0).toString()), ("2 years 2 months "));
+            assertEquals((accessor.getObject(1).toString()), ("2 years 2 months "));
+            assertEquals((accessor.getObject(2).toString()), ("0 years 0 months "));
+            assertEquals((accessor.getObject(3).toString()), ("2 years 2 months "));
+            assertEquals((accessor.getObject(4).toString()), ("0 years 0 months "));
+            assertEquals((accessor.getObject(5).toString()), ("1 year 10 months "));
+
 
             accessor = itr.next().getValueVector().getAccessor();
 
             // Check the interval day type
-            assertTrue((accessor.getObject(0)).equals("1 day 1:20:35.0"));
-            assertTrue((accessor.getObject(1)).equals("0 days 0:0:0.0"));
-            assertTrue((accessor.getObject(2)).equals("0 days 1:20:35.0"));
-            assertTrue((accessor.getObject(3)).equals("1 day 1:20:35.897"));
-            assertTrue((accessor.getObject(4)).equals("0 days 0:0:35.4"));
-            assertTrue((accessor.getObject(5)).equals("1 day 0:-39:-25.0"));
+            assertEquals((accessor.getObject(0).toString()), ("1 day 1:20:35.0"));
+            assertEquals((accessor.getObject(1).toString()), ("0 days 0:0:0.0"));
+            assertEquals((accessor.getObject(2).toString()), ("0 days 1:20:35.0"));
+            assertEquals((accessor.getObject(3).toString()), ("1 day 1:20:35.897"));
+            assertEquals((accessor.getObject(4).toString()), ("0 days 0:0:35.4"));
+            assertEquals((accessor.getObject(5).toString()), ("1 day 0:-39:-25.0"));
 
             batchLoader.clear();
             for(QueryResultBatch b : results){
@@ -260,7 +261,7 @@ public class TestDateTypes extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
-                assertTrue((accessor.getObject(0)).equals(result[idx++]));
+                assertEquals((accessor.getObject(0).toString()), (result[idx++]));
             }
 
             batchLoader.clear();
@@ -292,7 +293,8 @@ public class TestDateTypes extends PopUnitTestBase {
 
                 ValueVector.Accessor accessor = v.getValueVector().getAccessor();
 
-                assertTrue((accessor.getObject(0)).equals("2008-03-27"));
+                assertEquals((accessor.getObject(0).toString()), ("2008-03-27"));
+
 
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
index 788d7f1..6dc87e9 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
@@ -21,13 +21,14 @@ import static org.junit.Assert.assertEquals;
 
 import java.nio.charset.Charset;
 
+import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.expr.TypeHelper;
 import org.apache.drill.exec.memory.TopLevelAllocator;
-import org.apache.drill.exec.proto.SchemaDefProtos.FieldDef;
+import org.apache.drill.exec.proto.UserBitShared.SerializedField;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.vector.BitVector;
 import org.apache.drill.exec.vector.NullableFloat4Vector;
@@ -44,14 +45,11 @@ public class TestValueVector extends ExecTest {
   public void testFixedType() {
     // Build a required uint field definition
     MajorType.Builder typeBuilder = MajorType.newBuilder();
-    FieldDef.Builder defBuilder = FieldDef.newBuilder();
     typeBuilder
         .setMinorType(MinorType.UINT4)
         .setMode(DataMode.REQUIRED)
         .setWidth(4);
-    defBuilder
-        .setMajorType(typeBuilder.build());
-        MaterializedField field = MaterializedField.create(defBuilder.build());
+        MaterializedField field = MaterializedField.create(SchemaPath.getSimplePath(""), typeBuilder.build());
 
     // Create a new value vector for 1024 integers
     UInt4Vector v = new UInt4Vector(field, allocator);
@@ -78,7 +76,7 @@ public class TestValueVector extends ExecTest {
   public void testNullableVarLen2() {
     // Build an optional varchar field definition
     MajorType.Builder typeBuilder = MajorType.newBuilder();
-    FieldDef.Builder defBuilder = FieldDef.newBuilder();
+    SerializedField.Builder defBuilder = SerializedField.newBuilder();
     typeBuilder
         .setMinorType(MinorType.VARCHAR)
         .setMode(DataMode.OPTIONAL)
@@ -124,7 +122,7 @@ public class TestValueVector extends ExecTest {
   public void testNullableFixedType() {
     // Build an optional uint field definition
     MajorType.Builder typeBuilder = MajorType.newBuilder();
-    FieldDef.Builder defBuilder = FieldDef.newBuilder();
+    SerializedField.Builder defBuilder = SerializedField.newBuilder();
     typeBuilder
         .setMinorType(MinorType.UINT4)
         .setMode(DataMode.OPTIONAL)
@@ -211,7 +209,7 @@ public class TestValueVector extends ExecTest {
   public void testNullableFloat() {
     // Build an optional float field definition
     MajorType.Builder typeBuilder = MajorType.newBuilder();
-    FieldDef.Builder defBuilder = FieldDef.newBuilder();
+    SerializedField.Builder defBuilder = SerializedField.newBuilder();
     typeBuilder
         .setMinorType(MinorType.FLOAT4)
         .setMode(DataMode.OPTIONAL)
@@ -270,7 +268,7 @@ public class TestValueVector extends ExecTest {
   public void testBitVector() {
     // Build a required boolean field definition
     MajorType.Builder typeBuilder = MajorType.newBuilder();
-    FieldDef.Builder defBuilder = FieldDef.newBuilder();
+    SerializedField.Builder defBuilder = SerializedField.newBuilder();
     typeBuilder
         .setMinorType(MinorType.BIT)
         .setMode(DataMode.REQUIRED)

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java
deleted file mode 100644
index 9887536..0000000
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JSONRecordReaderTest.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.store.json;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-import mockit.Expectations;
-import mockit.Injectable;
-
-import org.apache.drill.common.exceptions.ExecutionSetupException;
-import org.apache.drill.common.expression.ExpressionPosition;
-import org.apache.drill.common.expression.FieldReference;
-import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.common.util.FileUtils;
-import org.apache.drill.exec.ExecTest;
-import org.apache.drill.exec.exception.SchemaChangeException;
-import org.apache.drill.exec.expr.TypeHelper;
-import org.apache.drill.exec.memory.BufferAllocator;
-import org.apache.drill.exec.memory.TopLevelAllocator;
-import org.apache.drill.exec.ops.FragmentContext;
-import org.apache.drill.exec.physical.impl.OutputMutator;
-import org.apache.drill.exec.proto.SchemaDefProtos;
-import org.apache.drill.exec.proto.UserBitShared;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.store.easy.json.JSONRecordReader;
-import org.apache.drill.exec.vector.ValueVector;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.junit.*;
-
-import com.google.common.collect.Lists;
-
-
-public class JSONRecordReaderTest extends ExecTest {
-  private static final Charset UTF_8 = Charset.forName("UTF-8");
-
-  private static MockOutputMutator mutator = new MockOutputMutator();
-
-  private String getResource(String resourceName) {
-    return "resource:" + resourceName;
-  }
-
-  @After
-  public void setup() {
-    for (ValueVector v: mutator.getAddFields()) {
-      v.clear();
-    }
-    mutator.removeAllFields();
-    mutator.removedFields.clear();
-  }
-   @AfterClass
-   public static void cleanup() {
-     mutator.close();
-   }
-
-  static class MockOutputMutator implements OutputMutator {
-    public List<MaterializedField> removedFields = Lists.newArrayList();
-    List<ValueVector> addFields = Lists.newArrayList();
-    private BufferAllocator allocator = new TopLevelAllocator();
-
-    @Override
-    public void removeField(MaterializedField field) throws SchemaChangeException {
-      removedFields.add(field);
-    }
-
-    @Override
-    public void addField(ValueVector vector) throws SchemaChangeException {
-      addFields.add(vector);
-    }
-
-    @Override
-    public void removeAllFields() {
-      addFields.clear();
-    }
-
-    @Override
-    public void setNewSchema() throws SchemaChangeException {
-    }
-
-    List<MaterializedField> getRemovedFields() {
-      return removedFields;
-    }
-
-    List<ValueVector> getAddFields() {
-      return addFields;
-    }
-
-    @Override
-    public <T extends ValueVector> T addField(MaterializedField field, Class<T> clazz) throws SchemaChangeException {
-      ValueVector v = TypeHelper.getNewVector(field, allocator);
-      if(!clazz.isAssignableFrom(v.getClass())) throw new SchemaChangeException(String.format("The class that was provided %s does not correspond to the expected vector type of %s.", clazz.getSimpleName(), v.getClass().getSimpleName()));
-      addField(v);
-      return (T) v;
-    }
-
-    public void close() {
-      allocator.close();
-    }
-  }
-
-  private <T> void assertField(ValueVector valueVector, int index, MinorType expectedMinorType, T value, String name) {
-    UserBitShared.FieldMetadata metadata = valueVector.getMetadata();
-    SchemaDefProtos.FieldDef def = metadata.getDef();
-    assertEquals(expectedMinorType, def.getMajorType().getMinorType());
-    String[] parts = name.split("\\.");
-    long expected = parts.length;
-    assertEquals(expected, def.getNameList().size());
-    for(int i = 0; i < parts.length; ++i) {
-      assertEquals(parts[i], def.getName(i).getName());
-    }
-
-    if (expectedMinorType == MinorType.MAP) {
-      return;
-    }
-
-    T val = (T) valueVector.getAccessor().getObject(index);
-    assertValue(value, val);
-  }
-
-  private void assertValue(Object expected, Object found) {
-    if (found instanceof byte[]) {
-      assertTrue(Arrays.equals((byte[]) expected, (byte[]) found));
-    } else if(found instanceof ArrayList) {
-      List expectedArray = (List) expected;
-      List foundArray = (List) found;
-      assertEquals(expectedArray.size(), foundArray.size());
-      for(int i = 0; i < expectedArray.size(); ++i) {
-        assertValue(expectedArray.get(i), foundArray.get(i));
-      }
-    } else {
-      assertEquals(expected, found);
-    }
-  }
-
-  @Test
-  public void testSameSchemaInSameBatch(@Injectable final FragmentContext context) throws IOException,
-      ExecutionSetupException {
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_1.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-    jr.setup(mutator);
-    assertEquals(2, jr.next());
-    assertEquals(3, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertField(addFields.get(1), 0, MinorType.BIT, true, "b");
-    assertField(addFields.get(2), 0, MinorType.VARCHAR, "hi!", "c");
-    assertField(addFields.get(0), 1, MinorType.BIGINT, 1234L, "test");
-    assertField(addFields.get(1), 1, MinorType.BIT, false, "b");
-    assertField(addFields.get(2), 1, MinorType.VARCHAR, "drill!", "c");
-
-    assertEquals(0, jr.next());
-    assertTrue(mutator.getRemovedFields().isEmpty());
-  }
-
-  @Test
-  public void testChangedSchemaInSameBatch(@Injectable final FragmentContext context) throws IOException,
-      ExecutionSetupException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_2.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-
-    jr.setup(mutator);
-    assertEquals(3, jr.next());
-    assertEquals(7, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertField(addFields.get(1), 0, MinorType.BIGINT, 1L, "b");
-    assertField(addFields.get(2), 0, MinorType.FLOAT4, (float) 2.15, "c");
-    assertField(addFields.get(3), 0, MinorType.BIT, true, "bool");
-    assertField(addFields.get(4), 0, MinorType.VARCHAR, "test1", "str1");
-
-    assertField(addFields.get(0), 1, MinorType.BIGINT, 1234L, "test");
-    assertField(addFields.get(1), 1, MinorType.BIGINT, 3L, "b");
-    assertField(addFields.get(3), 1, MinorType.BIT, false, "bool");
-    assertField(addFields.get(4), 1, MinorType.VARCHAR, "test2", "str1");
-    assertField(addFields.get(5), 1, MinorType.BIGINT, 4L, "d");
-
-    assertField(addFields.get(0), 2, MinorType.BIGINT, 12345L, "test");
-    assertField(addFields.get(2), 2, MinorType.FLOAT4, (float) 5.16, "c");
-    assertField(addFields.get(3), 2, MinorType.BIT, true, "bool");
-    assertField(addFields.get(5), 2, MinorType.BIGINT, 6L, "d");
-    assertField(addFields.get(6), 2, MinorType.VARCHAR, "test3", "str2");
-    assertTrue(mutator.getRemovedFields().isEmpty());
-    assertEquals(0, jr.next());
-  }
-
-  @Test
-  public void testChangedSchemaInTwoBatchesColumnSelect(@Injectable final FragmentContext context) throws IOException,
-      ExecutionSetupException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_2.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()),
-        64, Arrays.asList(new SchemaPath("test", ExpressionPosition.UNKNOWN))); // batch only fits 1 int
-    List<ValueVector> addFields = mutator.getAddFields();
-    List<MaterializedField> removedFields = mutator.getRemovedFields();
-
-    jr.setup(mutator);
-    assertEquals(1, jr.next());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertTrue(removedFields.isEmpty());
-    assertEquals(addFields.size(), 1);
-    assertEquals(1, jr.next());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 1234L, "test");
-    assertEquals(addFields.size(), 1);
-    assertTrue(removedFields.isEmpty());
-    removedFields.clear();
-    assertEquals(1, jr.next());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 12345L, "test");
-    assertEquals(addFields.size(), 1);
-    assertTrue(removedFields.isEmpty());
-    assertEquals(0, jr.next());
-  }
-
-  @Test
-  public void testChangedSchemaInTwoBatches(@Injectable final FragmentContext context) throws IOException,
-      ExecutionSetupException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_2.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()),
-        64, null); // batch only fits 1 int
-    List<ValueVector> addFields = mutator.getAddFields();
-    List<MaterializedField> removedFields = mutator.getRemovedFields();
-
-    jr.setup(mutator);
-    assertEquals(1, jr.next());
-    assertEquals(5, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertField(addFields.get(1), 0, MinorType.BIGINT, 1L, "b");
-    assertField(addFields.get(2), 0, MinorType.FLOAT4, (float) 2.15, "c");
-    assertField(addFields.get(3), 0, MinorType.BIT, true, "bool");
-    assertField(addFields.get(4), 0, MinorType.VARCHAR, "test1", "str1");
-    assertTrue(removedFields.isEmpty());
-    assertEquals(1, jr.next());
-    assertEquals(6, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 1234L, "test");
-    assertField(addFields.get(1), 0, MinorType.BIGINT, 3L, "b");
-    assertField(addFields.get(3), 0, MinorType.BIT, false, "bool");
-    assertField(addFields.get(4), 0, MinorType.VARCHAR, "test2", "str1");
-    assertField(addFields.get(5), 0, MinorType.BIGINT, 4L, "d");
-    assertEquals(1, removedFields.size());
-    assertEquals("c", removedFields.get(0).getAsSchemaPath().getRootSegment().getPath());
-    removedFields.clear();
-    assertEquals(1, jr.next());
-    assertEquals(7, addFields.size()); // The reappearing of field 'c' is also included
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 12345L, "test");
-    assertField(addFields.get(3), 0, MinorType.BIT, true, "bool");
-    assertField(addFields.get(5), 0, MinorType.BIGINT, 6L, "d");
-    assertField(addFields.get(2), 0, MinorType.FLOAT4, (float) 5.16, "c");
-    assertField(addFields.get(6), 0, MinorType.VARCHAR, "test3", "str2");
-    assertEquals(2, removedFields.size());
-    Iterables.find(removedFields, new Predicate<MaterializedField>() {
-      @Override
-      public boolean apply(MaterializedField materializedField) {
-        return materializedField.getAsSchemaPath().getRootSegment().getPath().equals("str1");
-      }
-    });
-    Iterables.find(removedFields, new Predicate<MaterializedField>() {
-      @Override
-      public boolean apply(MaterializedField materializedField) {
-        return materializedField.getAsSchemaPath().getRootSegment().getPath().equals("b");
-      }
-    });
-    assertEquals(0, jr.next());
-  }
-
-  @Test
-  @Ignore // until repeated map
-  public void testNestedFieldInSameBatch(@Injectable final FragmentContext context) throws ExecutionSetupException, IOException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_3.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-    jr.setup(mutator);
-    assertEquals(2, jr.next());
-    assertEquals(3, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertField(addFields.get(1), 0, MinorType.VARCHAR, "test", "a.b");
-    assertField(addFields.get(2), 0, MinorType.BIT, true, "a.a.d");
-    assertField(addFields.get(0), 1, MinorType.BIGINT, 1234L, "test");
-    assertField(addFields.get(1), 1, MinorType.VARCHAR, "test2", "a.b");
-    assertField(addFields.get(2), 1, MinorType.BIT, false, "a.a.d");
-
-    assertEquals(0, jr.next());
-    assertTrue(mutator.getRemovedFields().isEmpty());
-  }
-
-  @Test
-  @Ignore // until repeated map is added.
-  public void testRepeatedFields(@Injectable final FragmentContext context) throws ExecutionSetupException, IOException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_4.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-    jr.setup(mutator);
-    assertEquals(2, jr.next());
-    assertEquals(7, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, 123L, "test");
-    assertField(addFields.get(1), 0, MinorType.BIGINT, Arrays.asList(1L, 2L, 3L), "test2");
-    assertField(addFields.get(2), 0, MinorType.BIGINT, Arrays.asList(4L, 5L, 6L), "test3.a");
-    assertField(addFields.get(3), 0, MinorType.BIGINT, Arrays.asList(7L, 8L, 9L), "test3.b");
-    assertField(addFields.get(4), 0, MinorType.BIGINT, Arrays.asList(10L, 11L, 12L), "test3.c.d");
-    assertField(addFields.get(5), 0, MinorType.FLOAT4, Arrays.<Float>asList((float) 1.1, (float) 1.2, (float) 1.3), "testFloat");
-    assertField(addFields.get(6), 0, MinorType.VARCHAR, Arrays.asList("hello", "drill"), "testStr");
-    assertField(addFields.get(1), 1, MinorType.BIGINT, Arrays.asList(1L, 2L), "test2");
-    assertField(addFields.get(2), 1, MinorType.BIGINT, Arrays.asList(7L, 7L, 7L, 8L), "test3.a");
-    assertField(addFields.get(5), 1, MinorType.FLOAT4, Arrays.<Float>asList((float) 2.2, (float) 2.3,(float) 2.4), "testFloat");
-
-    assertEquals(0, jr.next());
-    assertTrue(mutator.getRemovedFields().isEmpty());
-  }
-
-  @Test
-  public void testRepeatedMissingFields(@Injectable final FragmentContext context) throws ExecutionSetupException, IOException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_5.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-    jr.setup(mutator);
-    assertEquals(9, jr.next());
-    assertEquals(1, addFields.size());
-    assertField(addFields.get(0), 0, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-    assertField(addFields.get(0), 1, MinorType.BIGINT, Arrays.asList(1L, 2L, 3L), "test");
-    assertField(addFields.get(0), 2, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-    assertField(addFields.get(0), 3, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-    assertField(addFields.get(0), 4, MinorType.BIGINT, Arrays.asList(4L, 5L, 6L), "test");
-    assertField(addFields.get(0), 5, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-    assertField(addFields.get(0), 6, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-    assertField(addFields.get(0), 7, MinorType.BIGINT, Arrays.asList(7L, 8L, 9L), "test");
-    assertField(addFields.get(0), 8, MinorType.BIGINT, Arrays.<Long>asList(), "test");
-
-
-    assertEquals(0, jr.next());
-    assertTrue(mutator.getRemovedFields().isEmpty());
-  }
-
-  @Test
-  public void testJsonArrayandNormalFields(@Injectable final FragmentContext context) throws ExecutionSetupException, IOException {
-
-    JSONRecordReader jr = new JSONRecordReader(context,
-        FileUtils.getResourceAsFile("/scan_json_test_7.json").toURI().toString(),
-        FileSystem.getLocal(new Configuration()), null);
-
-    List<ValueVector> addFields = mutator.getAddFields();
-    jr.setup(mutator);
-    assertEquals(2, jr.next());
-    assertEquals(3, addFields.size());
-
-    assertField(addFields.get(0), 0, MinorType.VARCHAR, "ABC", "test");
-    assertField(addFields.get(2), 0, MinorType.VARCHAR, "drill", "a");
-    assertField(addFields.get(0), 1, MinorType.VARCHAR, "abc", "test");
-    assertField(addFields.get(2), 1, MinorType.VARCHAR, "apache", "a");
-
-
-    assertEquals(0, jr.next());
-    assertTrue(mutator.getRemovedFields().isEmpty());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
new file mode 100644
index 0000000..1372219
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.store.json;
+
+import org.apache.drill.BaseTestQuery;
+import org.junit.Test;
+
+public class JsonRecordReader2Test extends BaseTestQuery{
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JsonRecordReader2Test.class);
+
+  @Test
+  public void testComplexJsonInput() throws Exception{
+//  test("select z[0]['orange']  from cp.`jsoninput/input2.json` limit 10");
+    test("select `integer`, x['y'] as x1, x['y'] as x2, z[0], z[0]['orange'], z[1]['pink']  from cp.`jsoninput/input2.json` limit 10");
+//    test("select z[0]  from cp.`jsoninput/input2.json` limit 10");
+  }
+
+  @Test
+  public void z() throws Exception{
+    test("select * from cp.`join/merge_join.json`");
+  }
+
+  @Test
+  public void y() throws Exception{
+    test("select * from cp.`limit/test1.json` limit 10");
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
new file mode 100644
index 0000000..7bc4a40
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.vector.complex.writer;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.memory.TopLevelAllocator;
+import org.apache.drill.exec.vector.complex.MapVector;
+import org.apache.drill.exec.vector.complex.fn.JsonReader;
+import org.apache.drill.exec.vector.complex.fn.JsonWriter;
+import org.apache.drill.exec.vector.complex.fn.ReaderJSONRecordSplitter;
+import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl;
+import org.apache.drill.exec.vector.complex.reader.FieldReader;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import com.google.common.base.Charsets;
+import com.google.hive12.common.collect.Lists;
+
+public class TestJsonReader {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJsonReader.class);
+
+  private static BufferAllocator allocator;
+
+  @BeforeClass
+  public static void setupAllocator(){
+    allocator = new TopLevelAllocator();
+  }
+
+  @AfterClass
+  public static void destroyAllocator(){
+    allocator.close();
+  }
+
+  @Test
+  public void testReader() throws Exception{
+    final int repeatSize = 10;
+
+    String simple = " { \"b\": \"hello\", \"c\": \"goodbye\"}\n " +
+        "{ \"b\": \"yellow\", \"c\": \"red\", \"p\":" +
+    "{ \"integer\" : 2001, \n" +
+        "  \"float\"   : 1.2,\n" +
+        "  \"x\": {\n" +
+        "    \"y\": \"friends\",\n" +
+        "    \"z\": \"enemies\"\n" +
+        "  },\n" +
+        "  \"z\": [\n" +
+        "    {\"orange\" : \"black\" },\n" +
+        "    {\"pink\" : \"purple\" }\n" +
+        "  ]\n" +
+        "  \n" +
+        "}\n }";
+
+    String compound = simple;
+    for(int i =0; i < repeatSize; i++) compound += simple;
+
+//    simple = "{ \"integer\" : 2001, \n" +
+//        "  \"float\"   : 1.2\n" +
+//        "}\n" +
+//        "{ \"integer\" : -2002,\n" +
+//        "  \"float\"   : -1.2 \n" +
+//        "}";
+    MapVector v = new MapVector("", allocator);
+    ComplexWriterImpl writer = new ComplexWriterImpl("col", v);
+    writer.allocate();
+
+
+    JsonReader jsonReader = new JsonReader(new ReaderJSONRecordSplitter(compound));
+    int i =0;
+    List<Integer> batchSizes = Lists.newArrayList();
+
+    outside: while(true){
+      writer.setPosition(i);
+      switch(jsonReader.write(writer)){
+      case WRITE_SUCCEED:
+        i++;
+        break;
+      case NO_MORE:
+        batchSizes.add(i);
+        System.out.println("no more records - main loop");
+        break outside;
+
+      case WRITE_FAILED:
+        System.out.println("==== hit bounds at " + i);
+        //writer.setValueCounts(i - 1);
+        batchSizes.add(i);
+        i = 0;
+        writer.allocate();
+        writer.reset();
+
+        switch(jsonReader.write(writer)){
+        case NO_MORE:
+          System.out.println("no more records - new alloc loop.");
+          break outside;
+        case WRITE_FAILED:
+          throw new RuntimeException("Failure while trying to write.");
+        case WRITE_SUCCEED:
+          i++;
+        };
+
+      };
+    }
+
+    int total = 0;
+    int lastRecordCount = 0;
+    for(Integer records : batchSizes){
+      total += records;
+      lastRecordCount = records;
+    }
+
+
+    ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+
+    ow.writeValueAsString(v.getAccessor().getObject(0));
+    ow.writeValueAsString(v.getAccessor().getObject(1));
+    FieldReader reader = v.get("col", MapVector.class).getAccessor().getReader();
+
+    ByteArrayOutputStream stream = new ByteArrayOutputStream();
+    JsonWriter jsonWriter = new JsonWriter(stream, true);
+
+    reader.setPosition(0);
+    jsonWriter.write(reader);
+    reader.setPosition(1);
+    jsonWriter.write(reader);
+    System.out.print("Json Read: ");
+    System.out.println(new String(stream.toByteArray(), Charsets.UTF_8));
+//    System.out.println(compound);
+
+    System.out.println("Total Records Written " + batchSizes);
+
+    reader.setPosition(lastRecordCount - 2);
+    assertEquals("goodbye", reader.reader("c").readText().toString());
+    reader.setPosition(lastRecordCount - 1);
+    assertEquals("red", reader.reader("c").readText().toString());
+    assertEquals((repeatSize+1) * 2, total);
+
+    writer.clear();
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
new file mode 100644
index 0000000..9c2e3b7
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestRepeated.java
@@ -0,0 +1,264 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.vector.complex.writer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.apache.drill.exec.expr.holders.BigIntHolder;
+import org.apache.drill.exec.expr.holders.IntHolder;
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.memory.TopLevelAllocator;
+import org.apache.drill.exec.vector.complex.MapVector;
+import org.apache.drill.exec.vector.complex.fn.JsonWriter;
+import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl;
+import org.apache.drill.exec.vector.complex.reader.FieldReader;
+import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter;
+import org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter;
+import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import com.google.common.base.Charsets;
+
+public class TestRepeated {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestRepeated.class);
+
+  private static BufferAllocator allocator;
+
+  @BeforeClass
+  public static void setupAllocator(){
+    allocator = new TopLevelAllocator();
+  }
+
+  @AfterClass
+  public static void destroyAllocator(){
+    allocator.close();
+  }
+//
+//  @Test
+//  public void repeatedMap(){
+//
+//    /**
+//     * We're going to try to create an object that looks like:
+//     *
+//     *  {
+//     *    a: [
+//     *      {x: 1, y: 2}
+//     *      {x: 2, y: 1}
+//     *    ]
+//     *  }
+//     *
+//     */
+//    MapVector v = new MapVector("", allocator);
+//    ComplexWriter writer = new ComplexWriterImpl("col", v);
+//
+//    MapWriter map = writer.rootAsMap();
+//
+//    map.start();
+//    ListWriter list = map.list("a");
+//    MapWriter inner = list.map();
+//
+//    IntHolder holder = new IntHolder();
+//    IntWriter xCol = inner.integer("x");
+//    IntWriter yCol = inner.integer("y");
+//
+//    inner.start();
+//
+//    holder.value = 1;
+//    xCol.write(holder);
+//    holder.value = 2;
+//    yCol.write(holder);
+//
+//    inner.end();
+//
+//    inner.start();
+//
+//    holder.value = 2;
+//    xCol.write(holder);
+//    holder.value = 1;
+//    yCol.write(holder);
+//
+//    inner.end();
+//
+//    IntWriter numCol = map.integer("nums");
+//    holder.value = 14;
+//    numCol.write(holder);
+//
+//    map.end();
+//
+//
+//    assert writer.ok();
+//
+//    System.out.println(v.getAccessor().getObject(0));
+//
+//  }
+
+  @Test
+  public void listOfList() throws IOException{
+    /**
+     * We're going to try to create an object that looks like:
+     *
+     *  {
+     *    a: [
+     *      [1,2,3],
+     *      [2,3,4]
+     *    ],
+     *    nums: 14,
+     *    b: [
+     *      { c: 1 },
+     *      { c: 2 , x: 15}
+     *    ]
+     *  }
+     *
+     */
+
+    MapVector v = new MapVector("", allocator);
+    ComplexWriterImpl writer = new ComplexWriterImpl("col", v);
+    writer.allocate();
+
+    {
+      MapWriter map = writer.rootAsMap();
+      ListWriter list = map.list("a");
+      list.start();
+
+      ListWriter innerList = list.list();
+      IntWriter innerInt = innerList.integer();
+
+      innerList.start();
+
+      IntHolder holder = new IntHolder();
+
+      holder.value = 1;
+      innerInt.write(holder);
+      holder.value = 2;
+      innerInt.write(holder);
+      holder.value = 3;
+      innerInt.write(holder);
+
+      innerList.end();
+      innerList.start();
+
+      holder.value = 4;
+      innerInt.write(holder);
+      holder.value = 5;
+      innerInt.write(holder);
+
+      innerList.end();
+      list.end();
+
+      IntWriter numCol = map.integer("nums");
+      holder.value = 14;
+      numCol.write(holder);
+
+      MapWriter repeatedMap = map.list("b").map();
+      repeatedMap.start();
+      holder.value = 1;
+      repeatedMap.integer("c").write(holder);
+      repeatedMap.end();
+
+      repeatedMap.start();
+      holder.value = 2;
+      repeatedMap.integer("c").write(holder);
+      BigIntHolder h = new BigIntHolder();
+      h.value = 15;
+      repeatedMap.bigInt("x").write(h);
+      repeatedMap.end();
+
+      map.end();
+    }
+    assert writer.ok();
+
+    {
+      writer.setPosition(1);
+
+      MapWriter map = writer.rootAsMap();
+      ListWriter list = map.list("a");
+      list.start();
+
+      ListWriter innerList = list.list();
+      IntWriter innerInt = innerList.integer();
+
+      innerList.start();
+
+      IntHolder holder = new IntHolder();
+
+      holder.value = -1;
+      innerInt.write(holder);
+      holder.value = -2;
+      innerInt.write(holder);
+      holder.value = -3;
+      innerInt.write(holder);
+
+      innerList.end();
+      innerList.start();
+
+      holder.value = -4;
+      innerInt.write(holder);
+      holder.value = -5;
+      innerInt.write(holder);
+
+      innerList.end();
+      list.end();
+
+      IntWriter numCol = map.integer("nums");
+      holder.value = -28;
+      numCol.write(holder);
+
+      MapWriter repeatedMap = map.list("b").map();
+      repeatedMap.start();
+      holder.value = -1;
+      repeatedMap.integer("c").write(holder);
+      repeatedMap.end();
+
+      repeatedMap.start();
+      holder.value = -2;
+      repeatedMap.integer("c").write(holder);
+      BigIntHolder h = new BigIntHolder();
+      h.value = -30;
+      repeatedMap.bigInt("x").write(h);
+      repeatedMap.end();
+
+      map.end();
+    }
+
+
+    ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
+
+    System.out.println("Map of Object[0]: " + ow.writeValueAsString(v.getAccessor().getObject(0)));
+    System.out.println("Map of Object[1]: " + ow.writeValueAsString(v.getAccessor().getObject(1)));
+
+
+    ByteArrayOutputStream stream = new ByteArrayOutputStream();
+    JsonWriter jsonWriter = new JsonWriter(stream, true);
+    FieldReader reader = v.get("col", MapVector.class).getAccessor().getReader();
+    reader.setPosition(0);
+    jsonWriter.write(reader);
+    reader.setPosition(1);
+    jsonWriter.write(reader);
+    System.out.print("Json Read: ");
+    System.out.println(new String(stream.toByteArray(), Charsets.UTF_8));
+
+    writer.clear();
+
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/java-exec/src/test/resources/jsoninput/input2.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/jsoninput/input2.json b/exec/java-exec/src/test/resources/jsoninput/input2.json
new file mode 100644
index 0000000..4e044c2
--- /dev/null
+++ b/exec/java-exec/src/test/resources/jsoninput/input2.json
@@ -0,0 +1,40 @@
+{ "integer" : 2010, 
+  "float"   : 17.4,
+  "x": {
+    "y": "kevin",
+    "z": "paul"
+  },
+  "z": [
+    {"orange" : "yellow" , "pink": "red"},
+    {"pink" : "purple" }
+  ],
+  "l": [4,2],
+  "rl": [ [2,1], [4,6] ]
+}
+{ "integer" : -2002,
+  "float"   : -1.2 
+}
+{ "integer" : 2001, 
+  "float"   : 1.2,
+  "x": {
+    "y": "bill",
+    "z": "peter"
+  },
+  "z": [
+    {"pink" : "lilac" }
+  ],
+  "l": [4,2],
+  "rl": [ [2,1], [4,6] ]
+}
+{ "integer" : 6005, 
+  "float"   : 1.2,
+  "x": {
+    "y": "mike",
+    "z": "mary"
+  },
+  "z": [
+    {"orange" : "stucco" }
+  ],
+  "l": [4,2],
+  "rl": [ [2,1], [4,6] ]
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillAccessorList.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillAccessorList.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillAccessorList.java
index 6394cb2..7594783 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillAccessorList.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillAccessorList.java
@@ -30,22 +30,22 @@ public class DrillAccessorList extends BasicList<Accessor>{
 
   private Accessor[] accessors = new Accessor[0];
   private int lastColumn = 1;
-  
+
   public void generateAccessors(DrillCursor cursor, RecordBatchLoader currentBatch){
     int cnt = currentBatch.getSchema().getFieldCount();
     accessors = new Accessor[cnt];
     for(int i =0; i < cnt; i++){
-      SqlAccessor acc = TypeHelper.getSqlAccessor(currentBatch.getValueAccessorById(i, null).getValueVector());
+      SqlAccessor acc = TypeHelper.getSqlAccessor(currentBatch.getValueAccessorById(null, i).getValueVector());
       accessors[i] = new AvaticaDrillSqlAccessor(acc, cursor);
     }
   }
-  
+
   @Override
   public Accessor get(int index) {
     lastColumn = index;
     return accessors[index];
   }
-  
+
   public boolean wasNull() throws SQLException{
     return accessors[lastColumn].wasNull();
   }
@@ -54,5 +54,5 @@ public class DrillAccessorList extends BasicList<Accessor>{
   public int size() {
     return accessors.length;
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java
index 10c36cb..4a57ffb 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java
@@ -39,6 +39,7 @@ import org.junit.rules.TestRule;
 import com.google.common.base.Function;
 import com.google.common.base.Stopwatch;
 
+@Ignore // until stream agg changing schema is fixed.
 public class TestAggregateFunctionsQuery {
 
   public static final String WORKING_PATH;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java
index 1212e9f..1c78b5f 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java
@@ -403,6 +403,7 @@ public class TestFunctionsQuery {
   }
 
   @Test
+  @Ignore
   public void testTimeStampConstant() throws Exception {
     String query = String.format("SELECT " +
         "timestamp '2008-2-23 12:23:23' as TS " +

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f903516..d135c56 100644
--- a/pom.xml
+++ b/pom.xml
@@ -501,6 +501,7 @@
             <executions>
               <execution>
                 <id>attach-sources</id>
+                <phase>verify</phase>
                 <goals>
                   <goal>jar</goal>
                 </goals>

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/cdc5daed/protocol/src/main/java/org/apache/drill/common/types/TypeProtos.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/common/types/TypeProtos.java b/protocol/src/main/java/org/apache/drill/common/types/TypeProtos.java
index 70125b2..9480ba4 100644
--- a/protocol/src/main/java/org/apache/drill/common/types/TypeProtos.java
+++ b/protocol/src/main/java/org/apache/drill/common/types/TypeProtos.java
@@ -317,6 +317,10 @@ public final class TypeProtos {
      * </pre>
      */
     INTERVALDAY(35, 39),
+    /**
+     * <code>LIST = 40;</code>
+     */
+    LIST(36, 40),
     ;
 
     /**
@@ -606,6 +610,10 @@ public final class TypeProtos {
      * </pre>
      */
     public static final int INTERVALDAY_VALUE = 39;
+    /**
+     * <code>LIST = 40;</code>
+     */
+    public static final int LIST_VALUE = 40;
 
 
     public final int getNumber() { return value; }
@@ -648,6 +656,7 @@ public final class TypeProtos {
         case 37: return NULL;
         case 38: return INTERVALYEAR;
         case 39: return INTERVALDAY;
+        case 40: return LIST;
         default: return null;
       }
     }
@@ -1779,7 +1788,7 @@ public final class TypeProtos {
       "inor_type\030\001 \001(\0162\021.common.MinorType\022\036\n\004mo" +
       "de\030\002 \001(\0162\020.common.DataMode\022\r\n\005width\030\003 \001(" +
       "\005\022\021\n\tprecision\030\004 \001(\005\022\r\n\005scale\030\005 \001(\005\022\020\n\010t" +
-      "imeZone\030\006 \001(\005*\373\003\n\tMinorType\022\010\n\004LATE\020\000\022\007\n" +
+      "imeZone\030\006 \001(\005*\205\004\n\tMinorType\022\010\n\004LATE\020\000\022\007\n" +
       "\003MAP\020\001\022\r\n\tREPEATMAP\020\002\022\013\n\007TINYINT\020\003\022\014\n\010SM" +
       "ALLINT\020\004\022\007\n\003INT\020\005\022\n\n\006BIGINT\020\006\022\014\n\010DECIMAL" +
       "9\020\007\022\r\n\tDECIMAL18\020\010\022\023\n\017DECIMAL28SPARSE\020\t\022" +
@@ -1792,9 +1801,9 @@ public final class TypeProtos {
       "NT1\020\035\022\t\n\005UINT2\020\036\022\t\n\005UINT4\020\037\022\t\n\005UINT8\020 \022\022" +
       "\n\016DECIMAL28DENSE\020!\022\022\n\016DECIMAL38DENSE\020\"\022\010" +
       "\n\004NULL\020%\022\020\n\014INTERVALYEAR\020&\022\017\n\013INTERVALDA" +
-      "Y\020\'*4\n\010DataMode\022\014\n\010OPTIONAL\020\000\022\014\n\010REQUIRE" +
-      "D\020\001\022\014\n\010REPEATED\020\002B-\n\035org.apache.drill.co" +
-      "mmon.typesB\nTypeProtosH\001"
+      "Y\020\'\022\010\n\004LIST\020(*4\n\010DataMode\022\014\n\010OPTIONAL\020\000\022" +
+      "\014\n\010REQUIRED\020\001\022\014\n\010REPEATED\020\002B-\n\035org.apach" +
+      "e.drill.common.typesB\nTypeProtosH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {