drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [3/3] drill git commit: DRILL-6210: Enhanced test schema utilities
Date Fri, 09 Mar 2018 05:27:23 GMT
DRILL-6210: Enhanced test schema utilities

closes #1150


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

Branch: refs/heads/master
Commit: f653359c7a5468ef94815e5d845980d254cda7b4
Parents: b4a783a
Author: Paul Rogers <progers@cloudera.com>
Authored: Sun Mar 4 16:14:33 2018 -0800
Committer: Ben-Zvi <bben-zvi@mapr.com>
Committed: Thu Mar 8 19:23:37 2018 -0800

----------------------------------------------------------------------
 .../java/org/apache/drill/TestStarQueries.java  |   2 +-
 .../java/org/apache/drill/TestUnionAll.java     |   2 +-
 .../org/apache/drill/TestUnionDistinct.java     |   2 +-
 .../apache/drill/exec/TestEmptyInputSql.java    |   2 +-
 .../exec/cache/TestBatchSerialization.java      |  22 +-
 .../impl/protocol/TestOperatorRecordBatch.java  |   2 +-
 .../impl/validate/TestBatchValidator.java       |  35 +-
 .../physical/impl/xsort/TestExternalSort.java   |   2 +-
 .../impl/xsort/managed/SortTestUtilities.java   |   2 +-
 .../physical/impl/xsort/managed/TestCopier.java |  23 +-
 .../impl/xsort/managed/TestShortArrays.java     |   9 +-
 .../impl/xsort/managed/TestSortImpl.java        |   2 +-
 .../physical/impl/xsort/managed/TestSorter.java |   4 +-
 .../rowSet/impl/TestResultSetLoaderLimits.java  |   2 +-
 .../impl/TestResultSetLoaderMapArray.java       | 124 ++--
 .../rowSet/impl/TestResultSetLoaderMaps.java    | 159 ++---
 .../impl/TestResultSetLoaderOmittedValues.java  |  23 +-
 .../impl/TestResultSetLoaderOverflow.java       |   2 +-
 .../impl/TestResultSetLoaderProjection.java     |  54 +-
 .../impl/TestResultSetLoaderProtocol.java       |   7 +-
 .../rowSet/impl/TestResultSetLoaderTorture.java |   8 +-
 .../rowSet/impl/TestResultSetSchemaChange.java  |  23 +-
 .../drill/exec/physical/unit/TestMiniPlan.java  |   2 +-
 .../physical/unit/TestNullInputMiniPlan.java    |   2 +-
 .../drill/exec/record/TestRecordBatchSizer.java |  17 +-
 .../drill/exec/record/TestTupleSchema.java      | 151 ++++-
 .../drill/exec/record/TestVectorContainer.java  |   2 +-
 .../drill/exec/record/vector/TestLoad.java      |  12 +-
 .../exec/store/TestImplicitFileColumns.java     |   2 +-
 .../exec/store/easy/text/compliant/TestCsv.java |   2 +-
 .../store/parquet/TestParquetMetadataCache.java |   2 +-
 .../java/org/apache/drill/test/ExampleTest.java |   2 +-
 .../apache/drill/test/rowSet/RowSetBuilder.java |   4 +-
 .../drill/test/rowSet/RowSetUtilities.java      |  73 ++-
 .../apache/drill/test/rowSet/RowSetWriter.java  |   3 +-
 .../drill/test/rowSet/RowSetWriterImpl.java     |   8 +-
 .../apache/drill/test/rowSet/SchemaBuilder.java | 252 --------
 .../drill/test/rowSet/schema/ColumnBuilder.java |  66 ++
 .../drill/test/rowSet/schema/MapBuilder.java    | 154 +++++
 .../test/rowSet/schema/RepeatedListBuilder.java |  96 +++
 .../drill/test/rowSet/schema/SchemaBuilder.java | 214 +++++++
 .../test/rowSet/schema/SchemaContainer.java     |  29 +
 .../drill/test/rowSet/schema/TupleBuilder.java  | 166 +++++
 .../drill/test/rowSet/schema/UnionBuilder.java  | 105 ++++
 .../drill/test/rowSet/schema/package-info.java  |  26 +
 .../drill/test/rowSet/test/DummyWriterTest.java |   6 +-
 .../drill/test/rowSet/test/PerformanceTool.java |   2 +-
 .../drill/test/rowSet/test/RowSetTest.java      |  33 +-
 .../drill/test/rowSet/test/TestFillEmpties.java |   2 +-
 .../test/rowSet/test/TestFixedWidthWriter.java  |   2 +-
 .../rowSet/test/TestOffsetVectorWriter.java     |   2 +-
 .../test/rowSet/test/TestScalarAccessors.java   |   2 +-
 .../test/rowSet/test/TestSchemaBuilder.java     | 598 +++++++++++++++++++
 .../rowSet/test/TestVariableWidthWriter.java    |   2 +-
 .../apache/drill/vector/TestFillEmpties.java    |   2 +-
 .../org/apache/drill/vector/TestToNullable.java |   2 +-
 56 files changed, 1996 insertions(+), 558 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
index 22cd618..b9e1752 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
@@ -23,8 +23,8 @@ import org.apache.drill.categories.UnlikelyTest;
 import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.exec.record.BatchSchema;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.apache.drill.test.BaseTestQuery;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
index 8f954bc..bdb8b43 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
@@ -30,7 +30,7 @@ import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedRelOperatorException;
 import org.apache.drill.test.BaseTestQuery;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java b/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
index e6cf842..00e8aec 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUnionDistinct.java
@@ -30,7 +30,7 @@ import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedRelOperatorException;
 import org.apache.drill.test.BaseTestQuery;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java
index d06151c..5bf31cd 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestEmptyInputSql.java
@@ -21,11 +21,11 @@ package org.apache.drill.exec;
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.drill.test.BaseTestQuery;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.drill.categories.UnlikelyTest;
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.exec.record.BatchSchema;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestBatchSerialization.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestBatchSerialization.java b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestBatchSerialization.java
index bcf0618..684c79a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestBatchSerialization.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestBatchSerialization.java
@@ -17,6 +17,10 @@
  */
 package org.apache.drill.exec.cache;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.objArray;
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
+import static org.junit.Assert.assertTrue;
+
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -26,8 +30,8 @@ import java.nio.channels.FileChannel;
 import java.nio.file.StandardOpenOption;
 
 import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.cache.VectorSerializer.Reader;
+import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.VectorContainer;
 import org.apache.drill.exec.record.selection.SelectionVector2;
 import org.apache.drill.test.DirTestWatcher;
@@ -39,14 +43,12 @@ import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetUtilities;
 import org.apache.drill.test.rowSet.RowSetWriter;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
-
 public class TestBatchSerialization extends DrillTest {
 
   @ClassRule
@@ -179,17 +181,17 @@ public class TestBatchSerialization extends DrillTest {
 
   private SingleRowSet buildMapSet(BatchSchema schema) {
     return fixture.rowSetBuilder(schema)
-        .addRow(1, new Object[] {100, "first"})
-        .addRow(2, new Object[] {200, "second"})
-        .addRow(3, new Object[] {300, "third"})
+        .addRow(1, objArray(100, "first"))
+        .addRow(2, objArray(200, "second"))
+        .addRow(3, objArray(300, "third"))
         .build();
   }
 
   private SingleRowSet buildArraySet(BatchSchema schema) {
     return fixture.rowSetBuilder(schema)
-        .addRow(1, new String[] { "first, second, third" } )
+        .addRow(1, strArray("first, second, third"))
         .addRow(2, null)
-        .addRow(3, new String[] { "third, fourth, fifth" } )
+        .addRow(3, strArray("third, fourth, fifth"))
         .build();
   }
 
@@ -206,7 +208,7 @@ public class TestBatchSerialization extends DrillTest {
         .addMap("map")
           .add("key", MinorType.INT)
           .add("value", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .build();
 
     verifySerialize(buildMapSet(schema).toIndirect(),

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/protocol/TestOperatorRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/protocol/TestOperatorRecordBatch.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/protocol/TestOperatorRecordBatch.java
index 19946dd..1203f48 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/protocol/TestOperatorRecordBatch.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/protocol/TestOperatorRecordBatch.java
@@ -48,7 +48,7 @@ import org.apache.drill.exec.vector.IntVector;
 import org.apache.drill.exec.vector.VarCharVector;
 import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/validate/TestBatchValidator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/validate/TestBatchValidator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/validate/TestBatchValidator.java
index 202a0f1..484ff7d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/validate/TestBatchValidator.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/validate/TestBatchValidator.java
@@ -17,13 +17,15 @@
  ******************************************************************************/
 package org.apache.drill.exec.physical.impl.validate;
 
-import static org.junit.Assert.*;
+import static org.apache.drill.test.rowSet.RowSetUtilities.intArray;
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 
 import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MinorType;
-import org.apache.drill.exec.physical.impl.validate.BatchValidator;
 import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.VectorAccessible;
 import org.apache.drill.exec.vector.RepeatedVarCharVector;
@@ -33,7 +35,7 @@ import org.apache.drill.exec.vector.VarCharVector;
 import org.apache.drill.test.LogFixture;
 import org.apache.drill.test.OperatorFixture;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -108,9 +110,9 @@ public class TestBatchValidator /* TODO: extends SubOperatorTest */ {
         .build();
 
     SingleRowSet batch = fixture.rowSetBuilder(schema)
-        .addRow(new int[] {}, new String[] {})
-        .addRow(new int[] {1, 2, 3}, new String[] {"fred", "barney", "wilma"})
-        .addRow(new int[] {4}, new String[] {"dino"})
+        .addRow(intArray(), strArray())
+        .addRow(intArray(1, 2, 3), strArray("fred", "barney", "wilma"))
+        .addRow(intArray(4), strArray("dino"))
         .build();
 
     BatchValidator validator = new BatchValidator(batch.vectorAccessible(), true);
@@ -135,10 +137,8 @@ public class TestBatchValidator /* TODO: extends SubOperatorTest */ {
     // Don't do this in real code!
 
     VectorAccessible va = batch.vectorAccessible();
-    @SuppressWarnings("resource")
     ValueVector v = va.iterator().next().getValueVector();
     VarCharVector vc = (VarCharVector) v;
-    @SuppressWarnings("resource")
     UInt4Vector ov = vc.getOffsetVector();
     assertTrue(ov.getAccessor().get(3) > 0);
     ov.getMutator().set(3, 0);
@@ -183,10 +183,8 @@ public class TestBatchValidator /* TODO: extends SubOperatorTest */ {
     // Don't do this in real code!
 
     VectorAccessible va = batch.vectorAccessible();
-    @SuppressWarnings("resource")
     ValueVector v = va.iterator().next().getValueVector();
     VarCharVector vc = (VarCharVector) v;
-    @SuppressWarnings("resource")
     UInt4Vector ov = vc.getOffsetVector();
     ov.getMutator().set(index, bogusValue);
   }
@@ -270,16 +268,14 @@ public class TestBatchValidator /* TODO: extends SubOperatorTest */ {
         .build();
 
     SingleRowSet batch = fixture.rowSetBuilder(schema)
-        .addRow((Object) new String[] {})
-        .addRow((Object) new String[] {"fred", "barney", "wilma"})
-        .addRow((Object) new String[] {"dino"})
+        .addRow((Object) strArray())
+        .addRow((Object) strArray("fred", "barney", "wilma"))
+        .addRow((Object) strArray("dino"))
         .build();
 
     VectorAccessible va = batch.vectorAccessible();
-    @SuppressWarnings("resource")
     ValueVector v = va.iterator().next().getValueVector();
     RepeatedVarCharVector vc = (RepeatedVarCharVector) v;
-    @SuppressWarnings("resource")
     UInt4Vector ov = vc.getOffsetVector();
     ov.getMutator().set(3, 1);
 
@@ -298,18 +294,15 @@ public class TestBatchValidator /* TODO: extends SubOperatorTest */ {
         .build();
 
     SingleRowSet batch = fixture.rowSetBuilder(schema)
-        .addRow((Object) new String[] {})
-        .addRow((Object) new String[] {"fred", "barney", "wilma"})
-        .addRow((Object) new String[] {"dino"})
+        .addRow((Object) strArray())
+        .addRow((Object) strArray("fred", "barney", "wilma"))
+        .addRow((Object) strArray("dino"))
         .build();
 
     VectorAccessible va = batch.vectorAccessible();
-    @SuppressWarnings("resource")
     ValueVector v = va.iterator().next().getValueVector();
     RepeatedVarCharVector rvc = (RepeatedVarCharVector) v;
-    @SuppressWarnings("resource")
     VarCharVector vc = rvc.getDataVector();
-    @SuppressWarnings("resource")
     UInt4Vector ov = vc.getOffsetVector();
     ov.getMutator().set(4, 100_000);
 

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestExternalSort.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestExternalSort.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestExternalSort.java
index 9ef1976..6e19f2e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestExternalSort.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/TestExternalSort.java
@@ -30,8 +30,8 @@ import org.apache.drill.test.BaseTestQuery;
 import org.apache.drill.test.TestBuilder;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSetBuilder;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.apache.drill.test.rowSet.file.JsonFileBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/SortTestUtilities.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/SortTestUtilities.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/SortTestUtilities.java
index 093c4ae..86228f5 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/SortTestUtilities.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/SortTestUtilities.java
@@ -38,8 +38,8 @@ import org.apache.drill.test.OperatorFixture;
 import org.apache.drill.test.rowSet.DirectRowSet;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.drill.test.rowSet.RowSetComparison;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 
 import com.google.common.collect.Lists;
 

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestCopier.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestCopier.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestCopier.java
index 66481a7..6de16bf 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestCopier.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestCopier.java
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.physical.impl.xsort.managed;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.objArray;
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
@@ -37,7 +38,7 @@ import org.apache.drill.test.rowSet.RowSet.ExtendableRowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetUtilities;
 import org.apache.drill.test.rowSet.RowSetWriter;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -348,28 +349,28 @@ public class TestCopier extends SubOperatorTest {
           .add("b", MinorType.INT)
           .addMap("m2")
             .add("c", MinorType.INT)
-            .buildMap()
-          .buildMap()
+            .resumeMap()
+          .resumeSchema()
         .build();
 
     CopierTester tester = new CopierTester(fixture);
     tester.addInput(fixture.rowSetBuilder(schema)
-        .addRow(1, new Object[] {10, new Object[] {100}})
-        .addRow(5, new Object[] {50, new Object[] {500}})
+        .addRow(1, objArray(10, objArray(100)))
+        .addRow(5, objArray(50, objArray(500)))
         .withSv2()
         .build());
 
     tester.addInput(fixture.rowSetBuilder(schema)
-        .addRow(2, new Object[] {20, new Object[] {200}})
-        .addRow(6, new Object[] {60, new Object[] {600}})
+        .addRow(2, objArray(20, objArray(200)))
+        .addRow(6, objArray(60, objArray(600)))
         .withSv2()
         .build());
 
     tester.addOutput(fixture.rowSetBuilder(schema)
-        .addRow(1, new Object[] {10, new Object[] {100}})
-        .addRow(2, new Object[] {20, new Object[] {200}})
-        .addRow(5, new Object[] {50, new Object[] {500}})
-        .addRow(6, new Object[] {60, new Object[] {600}})
+        .addRow(1, objArray(10, objArray(100)))
+        .addRow(2, objArray(20, objArray(200)))
+        .addRow(5, objArray(50, objArray(500)))
+        .addRow(6, objArray(60, objArray(600)))
         .build());
 
     tester.run();

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestShortArrays.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestShortArrays.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestShortArrays.java
index 735c5ce..6229dec 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestShortArrays.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestShortArrays.java
@@ -17,15 +17,16 @@
  */
 package org.apache.drill.exec.physical.impl.xsort.managed;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.intArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import org.apache.drill.common.types.TypeProtos.DataMode;
 import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.RecordBatchSizer;
 import org.apache.drill.exec.record.RecordBatchSizer.ColumnSize;
-import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.VectorInitializer;
 import org.apache.drill.exec.record.VectorInitializer.AllocationHint;
 import org.apache.drill.exec.vector.IntVector;
@@ -35,7 +36,7 @@ import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetBuilder;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**
@@ -61,9 +62,9 @@ public class TestShortArrays extends SubOperatorTest {
         .addArray("b", MinorType.INT)
         .build();
     RowSetBuilder builder = fixture.rowSetBuilder(schema)
-        .addRow(1, new int[] {10});
+        .addRow(1, intArray(10));
     for (int i = 2; i <= 10; i++) {
-      builder.addRow(i, new int[] {});
+      builder.addRow(i, intArray());
     }
     RowSet rows = builder.build();
 

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSortImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSortImpl.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSortImpl.java
index bcc53fa..50a729a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSortImpl.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSortImpl.java
@@ -47,11 +47,11 @@ import org.apache.drill.test.rowSet.HyperRowSetImpl;
 import org.apache.drill.test.rowSet.IndirectRowSet;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.ExtendableRowSet;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.drill.test.rowSet.RowSetBuilder;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
 import org.apache.drill.test.rowSet.RowSetWriter;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSorter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSorter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSorter.java
index d4cce28..49667ab 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSorter.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/xsort/managed/TestSorter.java
@@ -39,10 +39,10 @@ import org.apache.drill.test.rowSet.RowSet.ExtendableRowSet;
 import org.apache.drill.test.rowSet.RowSetReader;
 import org.apache.drill.test.rowSet.RowSetWriter;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.drill.test.rowSet.RowSetBuilder;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetUtilities;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.joda.time.Period;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -635,7 +635,7 @@ public class TestSorter extends DrillTest {
         .addMap("map")
           .add("key", MinorType.INT)
           .add("value", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .build();
 
     SingleRowSet input = fixture.rowSetBuilder(schema)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderLimits.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderLimits.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderLimits.java
index f9f5128..33ddd6a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderLimits.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderLimits.java
@@ -28,7 +28,7 @@ import org.apache.drill.exec.physical.rowSet.RowSetLoader;
 import org.apache.drill.exec.physical.rowSet.impl.ResultSetLoaderImpl.ResultSetOptions;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.test.SubOperatorTest;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMapArray.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMapArray.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMapArray.java
index 86e69aa..b2e3668 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMapArray.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMapArray.java
@@ -17,6 +17,8 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.objArray;
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -41,7 +43,7 @@ import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**
@@ -62,7 +64,7 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
         .addMapArray("m")
           .add("c", MinorType.INT)
           .add("d", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -83,28 +85,28 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(10, new Object[] {
-          new Object[] {110, "d1.1"},
-          new Object[] {120, "d2.2"}})
-      .addRow(20, new Object[] {})
-      .addRow(30, new Object[] {
-          new Object[] {310, "d3.1"},
-          new Object[] {320, "d3.2"},
-          new Object[] {330, "d3.3"}})
+      .addRow(10, objArray(
+          objArray(110, "d1.1"),
+          objArray(120, "d2.2")))
+      .addRow(20, objArray())
+      .addRow(30, objArray(
+          objArray(310, "d3.1"),
+          objArray(320, "d3.2"),
+          objArray(330, "d3.3")))
       ;
 
     // Verify the first batch
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {
-            new Object[] {110, "d1.1"},
-            new Object[] {120, "d2.2"}})
-        .addRow(20, new Object[] {})
-        .addRow(30, new Object[] {
-            new Object[] {310, "d3.1"},
-            new Object[] {320, "d3.2"},
-            new Object[] {330, "d3.3"}})
+        .addRow(10, objArray(
+            objArray(110, "d1.1"),
+            objArray(120, "d2.2")))
+        .addRow(20, objArray())
+        .addRow(30, objArray(
+            objArray(310, "d3.1"),
+            objArray(320, "d3.2"),
+            objArray(330, "d3.3")))
         .build();
     new RowSetComparison(expected).verifyAndClearAll(actual);
 
@@ -113,21 +115,21 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(40, new Object[] {
-          new Object[] {410, "d4.1"},
-          new Object[] {420, "d4.2"}});
+      .addRow(40, objArray(
+          objArray(410, "d4.1"),
+          objArray(420, "d4.2")));
 
     TupleWriter mapWriter = rootWriter.array("m").tuple();
     mapWriter.addColumn(SchemaBuilder.columnSchema("e", MinorType.VARCHAR, DataMode.OPTIONAL));
 
     rootWriter
-      .addRow(50, new Object[] {
-          new Object[] {510, "d5.1", "e5.1"},
-          new Object[] {520, "d5.2", null}})
-      .addRow(60, new Object[] {
-          new Object[] {610, "d6.1", "e6.1"},
-          new Object[] {620, "d6.2", null},
-          new Object[] {630, "d6.3", "e6.3"}})
+      .addRow(50, objArray(
+          objArray(510, "d5.1", "e5.1"),
+          objArray(520, "d5.2", null)))
+      .addRow(60, objArray(
+          objArray(610, "d6.1", "e6.1"),
+          objArray(620, "d6.2", null),
+          objArray(630, "d6.3", "e6.3")))
       ;
 
     // Verify the second batch
@@ -139,19 +141,19 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
           .add("c", MinorType.INT)
           .add("d", MinorType.VARCHAR)
           .addNullable("e", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(40, new Object[] {
-            new Object[] {410, "d4.1", null},
-            new Object[] {420, "d4.2", null}})
-        .addRow(50, new Object[] {
-            new Object[] {510, "d5.1", "e5.1"},
-            new Object[] {520, "d5.2", null}})
-        .addRow(60, new Object[] {
-            new Object[] {610, "d6.1", "e6.1"},
-            new Object[] {620, "d6.2", null},
-            new Object[] {630, "d6.3", "e6.3"}})
+        .addRow(40, objArray(
+            objArray(410, "d4.1", null),
+            objArray(420, "d4.2", null)))
+        .addRow(50, objArray(
+            objArray(510, "d5.1", "e5.1"),
+            objArray(520, "d5.2", null)))
+        .addRow(60, objArray(
+            objArray(610, "d6.1", "e6.1"),
+            objArray(620, "d6.2", null),
+            objArray(630, "d6.3", "e6.3")))
         .build();
     new RowSetComparison(expected).verifyAndClearAll(actual);
 
@@ -165,7 +167,7 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
         .addMapArray("m")
           .add("c", MinorType.INT)
           .addArray("d", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -179,28 +181,28 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(10, new Object[] {
-          new Object[] {110, new String[] {"d1.1.1", "d1.1.2"}},
-          new Object[] {120, new String[] {"d1.2.1", "d1.2.2"}}})
-      .addRow(20, new Object[] {})
-      .addRow(30, new Object[] {
-          new Object[] {310, new String[] {"d3.1.1", "d3.2.2"}},
-          new Object[] {320, new String[] {}},
-          new Object[] {330, new String[] {"d3.3.1", "d1.2.2"}}})
+      .addRow(10, objArray(
+          objArray(110, strArray("d1.1.1", "d1.1.2")),
+          objArray(120, strArray("d1.2.1", "d1.2.2"))))
+      .addRow(20, objArray())
+      .addRow(30, objArray(
+          objArray(310, strArray("d3.1.1", "d3.2.2")),
+          objArray(320, strArray()),
+          objArray(330, strArray("d3.3.1", "d1.2.2"))))
       ;
 
     // Verify the batch
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {
-            new Object[] {110, new String[] {"d1.1.1", "d1.1.2"}},
-            new Object[] {120, new String[] {"d1.2.1", "d1.2.2"}}})
-        .addRow(20, new Object[] {})
-        .addRow(30, new Object[] {
-            new Object[] {310, new String[] {"d3.1.1", "d3.2.2"}},
-            new Object[] {320, new String[] {}},
-            new Object[] {330, new String[] {"d3.3.1", "d1.2.2"}}})
+        .addRow(10, objArray(
+            objArray(110, strArray("d1.1.1", "d1.1.2")),
+            objArray(120, strArray("d1.2.1", "d1.2.2"))))
+        .addRow(20, objArray())
+        .addRow(30, objArray(
+            objArray(310, strArray("d3.1.1", "d3.2.2")),
+            objArray(320, strArray()),
+            objArray(330, strArray("d3.3.1", "d1.2.2"))))
         .build();
     new RowSetComparison(expected).verifyAndClearAll(actual);
 
@@ -220,8 +222,8 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
           .addMapArray("m2")
             .add("c", MinorType.INT)
             .addArray("d", MinorType.VARCHAR)
-            .buildMap()
-          .buildMap()
+            .resumeMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -304,7 +306,7 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
         .addMapArray("m")
           .add("b", MinorType.INT)
           .add("c", MinorType.VARCHAR)
-        .buildMap()
+        .resumeSchema()
       .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -378,7 +380,7 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
         .addMapArray("m")
           .addNullable("a", MinorType.INT)
           .addNullable("b", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -451,7 +453,7 @@ public class TestResultSetLoaderMapArray extends SubOperatorTest {
         .addMapArray("m")
           .add("a", MinorType.INT)
           .add("b", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMaps.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMaps.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMaps.java
index 2aaa934..11f449b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMaps.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderMaps.java
@@ -17,6 +17,9 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.intArray;
+import static org.apache.drill.test.rowSet.RowSetUtilities.objArray;
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -39,7 +42,7 @@ import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**
@@ -55,7 +58,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .addMap("m")
           .add("c", MinorType.INT)
           .add("d", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .add("e", MinorType.VARCHAR)
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
@@ -101,7 +104,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
 
     // Write another using the test-time conveniences
 
-    rootWriter.addRow(20, new Object[] {210, "barney"}, "bam-bam");
+    rootWriter.addRow(20, objArray(210, "barney"), "bam-bam");
 
     // Harvest the batch
 
@@ -112,8 +115,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     // Validate data
 
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {110, "fred"}, "pebbles")
-        .addRow(20, new Object[] {210, "barney"}, "bam-bam")
+        .addRow(10, objArray(110, "fred"), "pebbles")
+        .addRow(20, objArray(210, "barney"), "bam-bam")
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -132,7 +135,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .add("a", MinorType.INT)
         .addMap("m")
           .add("b", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -143,8 +146,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(10, new Object[] {"fred"})
-      .addRow(20, new Object[] {"barney"});
+      .addRow(10, objArray("fred"))
+      .addRow(20, objArray("barney"));
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     assertEquals(3, rsLoader.schemaVersion());
@@ -153,8 +156,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     // Validate first batch
 
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {"fred"})
-        .addRow(20, new Object[] {"barney"})
+        .addRow(10, objArray("fred"))
+        .addRow(20, objArray("barney"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -169,10 +172,10 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     rsLoader.startBatch();
     mapWriter.addColumn(SchemaBuilder.columnSchema("d", MinorType.BIGINT, DataMode.REQUIRED));
 
-    rootWriter.addRow(30, new Object[] {"wilma", 130, 130_000L});
+    rootWriter.addRow(30, objArray("wilma", 130, 130_000L));
 
     mapWriter.addColumn(SchemaBuilder.columnSchema("e", MinorType.VARCHAR, DataMode.REQUIRED));
-    rootWriter.addRow(40, new Object[] {"betty", 140, 140_000L, "bam-bam"});
+    rootWriter.addRow(40, objArray("betty", 140, 140_000L, "bam-bam"));
 
     actual = fixture.wrap(rsLoader.harvest());
     assertEquals(6, rsLoader.schemaVersion());
@@ -187,11 +190,11 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
           .add("c", MinorType.INT)
           .add("d", MinorType.BIGINT)
           .add("e", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(30, new Object[] {"wilma", 130, 130_000L, ""})
-        .addRow(40, new Object[] {"betty", 140, 140_000L, "bam-bam"})
+        .addRow(30, objArray("wilma", 130, 130_000L, ""))
+        .addRow(40, objArray("betty", 140, 140_000L, "bam-bam"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -229,8 +232,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     mapWriter.addColumn(SchemaBuilder.columnSchema("a", MinorType.VARCHAR, DataMode.REQUIRED));
 
     rootWriter
-      .addRow(20, new Object[]{"fred"})
-      .addRow(30, new Object[]{"barney"});
+      .addRow(20, objArray("fred"))
+      .addRow(30, objArray("barney"));
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     assertEquals(3, rsLoader.schemaVersion());
@@ -242,12 +245,12 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .add("a", MinorType.INT)
         .addMap("m")
           .add("a", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(10, new Object[] {""})
-        .addRow(20, new Object[] {"fred"})
-        .addRow(30, new Object[] {"barney"})
+        .addRow(10, objArray(""))
+        .addRow(20, objArray("fred"))
+        .addRow(30, objArray("barney"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -282,8 +285,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     TupleWriter mapWriter = rootWriter.tuple(mapIndex);
 
     rootWriter
-      .addRow(20, new Object[]{})
-      .addRow(30, new Object[]{});
+      .addRow(20, objArray())
+      .addRow(30, objArray());
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     assertEquals(2, rsLoader.schemaVersion());
@@ -294,12 +297,12 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     TupleMetadata expectedSchema = new SchemaBuilder()
         .add("a", MinorType.INT)
         .addMap("m")
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(10, new Object[] {})
-        .addRow(20, new Object[] {})
-        .addRow(30, new Object[] {})
+        .addRow(10, objArray())
+        .addRow(20, objArray())
+        .addRow(30, objArray())
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -310,8 +313,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     mapWriter.addColumn(SchemaBuilder.columnSchema("a", MinorType.VARCHAR, DataMode.REQUIRED));
 
     rootWriter
-      .addRow(40, new Object[]{"fred"})
-      .addRow(50, new Object[]{"barney"});
+      .addRow(40, objArray("fred"))
+      .addRow(50, objArray("barney"));
 
     actual = fixture.wrap(rsLoader.harvest());
     assertEquals(3, rsLoader.schemaVersion());
@@ -323,11 +326,11 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .add("a", MinorType.INT)
         .addMap("m")
           .add("a", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(40, new Object[] {"fred"})
-        .addRow(50, new Object[] {"barney"})
+        .addRow(40, objArray("fred"))
+        .addRow(50, objArray("barney"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -350,8 +353,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
           .add("b", MinorType.VARCHAR)
           .addMap("m2")
             .add("c", MinorType.VARCHAR)
-            .buildMap()
-          .buildMap()
+            .resumeMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -361,14 +364,14 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     RowSetLoader rootWriter = rsLoader.writer();
 
     rsLoader.startBatch();
-    rootWriter.addRow(10, new Object[] {"b1", new Object[] {"c1"}});
+    rootWriter.addRow(10, objArray("b1", objArray("c1")));
 
     // Validate first batch
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     assertEquals(5, rsLoader.schemaVersion());
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {"b1", new Object[] {"c1"}})
+        .addRow(10, objArray("b1", objArray("c1")))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -376,21 +379,21 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     // Now add columns in the second batch.
 
     rsLoader.startBatch();
-    rootWriter.addRow(20, new Object[] {"b2", new Object[] {"c2"}});
+    rootWriter.addRow(20, objArray("b2", objArray("c2")));
 
     TupleWriter m1Writer = rootWriter.tuple("m1");
     m1Writer.addColumn(SchemaBuilder.columnSchema("d", MinorType.VARCHAR, DataMode.REQUIRED));
     TupleWriter m2Writer = m1Writer.tuple("m2");
     m2Writer.addColumn(SchemaBuilder.columnSchema("e", MinorType.VARCHAR, DataMode.REQUIRED));
 
-    rootWriter.addRow(30, new Object[] {"b3", new Object[] {"c3", "e3"}, "d3"});
+    rootWriter.addRow(30, objArray("b3", objArray("c3", "e3"), "d3"));
 
     // And another set while the write proceeds.
 
     m1Writer.addColumn(SchemaBuilder.columnSchema("f", MinorType.VARCHAR, DataMode.REQUIRED));
     m2Writer.addColumn(SchemaBuilder.columnSchema("g", MinorType.VARCHAR, DataMode.REQUIRED));
 
-    rootWriter.addRow(40, new Object[] {"b4", new Object[] {"c4", "e4", "g4"}, "d4", "e4"});
+    rootWriter.addRow(40, objArray("b4", objArray("c4", "e4", "g4"), "d4", "e4"));
 
     // Validate second batch
 
@@ -405,15 +408,15 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
             .add("c", MinorType.VARCHAR)
             .add("e", MinorType.VARCHAR)
             .add("g", MinorType.VARCHAR)
-            .buildMap()
+            .resumeMap()
           .add("d", MinorType.VARCHAR)
           .add("f", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(20, new Object[] {"b2", new Object[] {"c2", "",   ""  }, "",    "" })
-        .addRow(30, new Object[] {"b3", new Object[] {"c3", "e3", ""  }, "d3",  "" })
-        .addRow(40, new Object[] {"b4", new Object[] {"c4", "e4", "g4"}, "d4", "e4"})
+        .addRow(20, objArray("b2", objArray("c2", "",   ""  ), "",    "" ))
+        .addRow(30, objArray("b3", objArray("c3", "e3", ""  ), "d3",  "" ))
+        .addRow(40, objArray("b4", objArray("c4", "e4", "g4"), "d4", "e4"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -434,8 +437,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
           .addNullable("b", MinorType.VARCHAR)
           .addMap("m2")
             .addNullable("c", MinorType.VARCHAR)
-            .buildMap()
-          .buildMap()
+            .resumeMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -444,13 +447,13 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     RowSetLoader rootWriter = rsLoader.writer();
 
     rsLoader.startBatch();
-    rootWriter.addRow(10, new Object[] {"b1", new Object[] {"c1"}});
+    rootWriter.addRow(10, objArray("b1", objArray("c1")));
 
     // Validate first batch
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {"b1", new Object[] {"c1"}})
+        .addRow(10, objArray("b1", objArray("c1")))
         .build();
 //    actual.print();
 //    expected.print();
@@ -460,21 +463,21 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     // Now add columns in the second batch.
 
     rsLoader.startBatch();
-    rootWriter.addRow(20, new Object[] {"b2", new Object[] {"c2"}});
+    rootWriter.addRow(20, objArray("b2", objArray("c2")));
 
     TupleWriter m1Writer = rootWriter.tuple("m1");
     m1Writer.addColumn(SchemaBuilder.columnSchema("d", MinorType.VARCHAR, DataMode.OPTIONAL));
     TupleWriter m2Writer = m1Writer.tuple("m2");
     m2Writer.addColumn(SchemaBuilder.columnSchema("e", MinorType.VARCHAR, DataMode.OPTIONAL));
 
-    rootWriter.addRow(30, new Object[] {"b3", new Object[] {"c3", "e3"}, "d3"});
+    rootWriter.addRow(30, objArray("b3", objArray("c3", "e3"), "d3"));
 
     // And another set while the write proceeds.
 
     m1Writer.addColumn(SchemaBuilder.columnSchema("f", MinorType.VARCHAR, DataMode.OPTIONAL));
     m2Writer.addColumn(SchemaBuilder.columnSchema("g", MinorType.VARCHAR, DataMode.OPTIONAL));
 
-    rootWriter.addRow(40, new Object[] {"b4", new Object[] {"c4", "e4", "g4"}, "d4", "e4"});
+    rootWriter.addRow(40, objArray("b4", objArray("c4", "e4", "g4"), "d4", "e4"));
 
     // Validate second batch
 
@@ -487,15 +490,15 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
             .addNullable("c", MinorType.VARCHAR)
             .addNullable("e", MinorType.VARCHAR)
             .addNullable("g", MinorType.VARCHAR)
-            .buildMap()
+            .resumeMap()
           .addNullable("d", MinorType.VARCHAR)
           .addNullable("f", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(20, new Object[] {"b2", new Object[] {"c2", null, null}, null, null})
-        .addRow(30, new Object[] {"b3", new Object[] {"c3", "e3", null}, "d3", null})
-        .addRow(40, new Object[] {"b4", new Object[] {"c4", "e4", "g4"}, "d4", "e4"})
+        .addRow(20, objArray("b2", objArray("c2", null, null), null, null))
+        .addRow(30, objArray("b3", objArray("c3", "e3", null), "d3", null))
+        .addRow(40, objArray("b4", objArray("c4", "e4", "g4"), "d4", "e4"))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -517,7 +520,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .addMap("m")
           .addArray("c", MinorType.INT)
           .addArray("d", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -529,20 +532,20 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(10, new Object[] {new int[] {110, 120, 130},
-                                new String[] {"d1.1", "d1.2", "d1.3", "d1.4"}})
-      .addRow(20, new Object[] {new int[] {210}, new String[] {}})
-      .addRow(30, new Object[] {new int[] {}, new String[] {"d3.1"}})
+      .addRow(10, objArray(intArray(110, 120, 130),
+                                strArray("d1.1", "d1.2", "d1.3", "d1.4")))
+      .addRow(20, objArray(intArray(210), strArray()))
+      .addRow(30, objArray(intArray(), strArray("d3.1")))
       ;
 
     // Validate first batch
 
     RowSet actual = fixture.wrap(rsLoader.harvest());
     SingleRowSet expected = fixture.rowSetBuilder(schema)
-        .addRow(10, new Object[] {new int[] {110, 120, 130},
-                                  new String[] {"d1.1", "d1.2", "d1.3", "d1.4"}})
-        .addRow(20, new Object[] {new int[] {210}, new String[] {}})
-        .addRow(30, new Object[] {new int[] {}, new String[] {"d3.1"}})
+        .addRow(10, objArray(intArray(110, 120, 130),
+                                  strArray("d1.1", "d1.2", "d1.3", "d1.4")))
+        .addRow(20, objArray(intArray(210), strArray()))
+        .addRow(30, objArray(intArray(), strArray("d3.1")))
         .build();
 
     new RowSetComparison(expected).verifyAndClearAll(actual);
@@ -551,15 +554,15 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter
-      .addRow(40, new Object[] {new int[] {410, 420}, new String[] {"d4.1", "d4.2"}})
-      .addRow(50, new Object[] {new int[] {510}, new String[] {"d5.1"}})
+      .addRow(40, objArray(intArray(410, 420), strArray("d4.1", "d4.2")))
+      .addRow(50, objArray(intArray(510), strArray("d5.1")))
       ;
 
     TupleWriter mapWriter = rootWriter.tuple("m");
     mapWriter.addColumn(SchemaBuilder.columnSchema("e", MinorType.VARCHAR, DataMode.REPEATED));
     rootWriter
-      .addRow(60, new Object[] {new int[] {610, 620}, new String[] {"d6.1", "d6.2"}, new String[] {"e6.1", "e6.2"}})
-      .addRow(70, new Object[] {new int[] {710}, new String[] {}, new String[] {"e7.1", "e7.2"}})
+      .addRow(60, objArray(intArray(610, 620), strArray("d6.1", "d6.2"), strArray("e6.1", "e6.2")))
+      .addRow(70, objArray(intArray(710), strArray(), strArray("e7.1", "e7.2")))
       ;
 
     // Validate first batch. The new array should have been back-filled with
@@ -568,10 +571,10 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     actual = fixture.wrap(rsLoader.harvest());
 //    System.out.println(actual.schema().toString());
     expected = fixture.rowSetBuilder(actual.schema())
-        .addRow(40, new Object[] {new int[] {410, 420}, new String[] {"d4.1", "d4.2"}, new String[] {}})
-        .addRow(50, new Object[] {new int[] {510}, new String[] {"d5.1"}, new String[] {}})
-        .addRow(60, new Object[] {new int[] {610, 620}, new String[] {"d6.1", "d6.2"}, new String[] {"e6.1", "e6.2"}})
-        .addRow(70, new Object[] {new int[] {710}, new String[] {}, new String[] {"e7.1", "e7.2"}})
+        .addRow(40, objArray(intArray(410, 420), strArray("d4.1", "d4.2"), strArray()))
+        .addRow(50, objArray(intArray(510), strArray("d5.1"), strArray()))
+        .addRow(60, objArray(intArray(610, 620), strArray("d6.1", "d6.2"), strArray("e6.1", "e6.2")))
+        .addRow(70, objArray(intArray(710), strArray(), strArray("e7.1", "e7.2")))
         .build();
 //    expected.print();
 
@@ -596,8 +599,8 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
             .add("c", MinorType.INT) // Before overflow, written
             .add("d", MinorType.VARCHAR)
             .add("e", MinorType.INT) // After overflow, not yet written
-            .buildMap()
-          .buildMap()
+            .resumeMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -611,7 +614,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
     int count = 0;
     rsLoader.startBatch();
     while (! rootWriter.isFull()) {
-      rootWriter.addRow(count, new Object[] {count * 10, new Object[] {count * 100, value, count * 1000}});
+      rootWriter.addRow(count, objArray(count * 10, objArray(count * 100, value, count * 1000)));
       count++;
     }
 
@@ -662,7 +665,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .addMap("m")
           .add("b", MinorType.INT)
           .add("c", MinorType.VARCHAR)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)
@@ -755,7 +758,7 @@ public class TestResultSetLoaderMaps extends SubOperatorTest {
         .addMap("m")
           .add("b", MinorType.INT)
           .add("c", MinorType.VARCHAR)
-        .buildMap()
+        .resumeSchema()
       .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setSchema(schema)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOmittedValues.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOmittedValues.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOmittedValues.java
index b0df724..5fd65a9 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOmittedValues.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOmittedValues.java
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -34,7 +35,7 @@ import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 public class TestResultSetLoaderOmittedValues extends SubOperatorTest {
@@ -144,16 +145,16 @@ public class TestResultSetLoaderOmittedValues extends SubOperatorTest {
         .addArray("f", MinorType.VARCHAR)
         .build();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow(  1, "b_1", "c_1",  10,  100, new String[] {"f_1-1",  "f_1-2"})
-        .addRow(  2, "b_2", "c_2",  20,  200, new String[] {"f_2-1",  "f_2-2"})
-        .addRow(  3, "b_3", null,   30, null, new String[] {"f_3-1",  "f_3-2"})
-        .addRow(  4, "b_4", null,   40, null, new String[] {"f_4-1",  "f_4-2"})
-        .addRow(  5, "",    "c_5",   0,  500, new String[] {})
-        .addRow(  6, "",    "c_6",   0,  600, new String[] {})
-        .addRow(  7, "b_7", "c_7",  70,  700, new String[] {"f_7-1",  "f_7-2"})
-        .addRow(  8, "b_8", "c_8",  80,  800, new String[] {"f_8-1",  "f_8-2"})
-        .addRow(  9, "",    null,    0, null, new String[] {})
-        .addRow( 10, "",    null,    0, null, new String[] {})
+        .addRow(  1, "b_1", "c_1",  10,  100, strArray("f_1-1",  "f_1-2"))
+        .addRow(  2, "b_2", "c_2",  20,  200, strArray("f_2-1",  "f_2-2"))
+        .addRow(  3, "b_3", null,   30, null, strArray("f_3-1",  "f_3-2"))
+        .addRow(  4, "b_4", null,   40, null, strArray("f_4-1",  "f_4-2"))
+        .addRow(  5, "",    "c_5",   0,  500, strArray())
+        .addRow(  6, "",    "c_6",   0,  600, strArray())
+        .addRow(  7, "b_7", "c_7",  70,  700, strArray("f_7-1",  "f_7-2"))
+        .addRow(  8, "b_8", "c_8",  80,  800, strArray("f_8-1",  "f_8-2"))
+        .addRow(  9, "",    null,    0, null, strArray())
+        .addRow( 10, "",    null,    0, null, strArray())
         .build();
 
     new RowSetComparison(expected)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOverflow.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOverflow.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOverflow.java
index c9ab4e0..bb82131 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOverflow.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderOverflow.java
@@ -37,7 +37,7 @@ import org.apache.drill.exec.vector.accessor.ScalarWriter;
 import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 import com.google.common.base.Charsets;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProjection.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProjection.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProjection.java
index e28745b..b69e797 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProjection.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProjection.java
@@ -17,7 +17,11 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
-import static org.junit.Assert.*;
+import static org.apache.drill.test.rowSet.RowSetUtilities.objArray;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,9 +39,9 @@ import org.apache.drill.exec.record.metadata.TupleMetadata;
 import org.apache.drill.exec.vector.ValueVector;
 import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet;
-import org.apache.drill.test.rowSet.RowSetComparison;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
+import org.apache.drill.test.rowSet.RowSetComparison;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -244,15 +248,15 @@ public class TestResultSetLoaderProjection extends SubOperatorTest {
         .addMap("m1")
           .add("a", MinorType.INT)
           .add("b", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .addMap("m2")
           .add("c", MinorType.INT)
           .add("d", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .addMap("m3")
           .add("e", MinorType.INT)
           .add("f", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetOptions options = new OptionBuilder()
         .setProjection(selection)
@@ -312,14 +316,14 @@ public class TestResultSetLoaderProjection extends SubOperatorTest {
       .addMap("m1")
         .add("a", MinorType.INT)
         .add("b", MinorType.INT)
-        .buildMap()
+        .resumeSchema()
       .addMap("m2")
         .add("d", MinorType.INT)
-        .buildMap()
+        .resumeSchema()
       .build();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
-      .addRow(new Object[] {1, 2}, new Object[] {4})
-      .addRow(new Object[] {11, 12}, new Object[] {14})
+      .addRow(objArray(1, 2), objArray(4))
+      .addRow(objArray(11, 12), objArray(14))
       .build();
     new RowSetComparison(expected)
         .verifyAndClearAll(fixture.wrap(rsLoader.harvest()));
@@ -341,15 +345,15 @@ public class TestResultSetLoaderProjection extends SubOperatorTest {
         .addMapArray("m1")
           .add("a", MinorType.INT)
           .add("b", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .addMapArray("m2")
           .add("c", MinorType.INT)
           .add("d", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .addMapArray("m3")
           .add("e", MinorType.INT)
           .add("f", MinorType.INT)
-          .buildMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetOptions options = new OptionBuilder()
         .setProjection(selection)
@@ -362,13 +366,13 @@ public class TestResultSetLoaderProjection extends SubOperatorTest {
 
     rsLoader.startBatch();
     rootWriter.addRow(
-        new Object[] { new Object[] {10, 20}, new Object[] {11, 21}},
-        new Object[] { new Object[] {30, 40}, new Object[] {31, 42}},
-        new Object[] { new Object[] {50, 60}, new Object[] {51, 62}});
+        objArray(objArray(10, 20), objArray(11, 21)),
+        objArray(objArray(30, 40), objArray(31, 42)),
+        objArray(objArray(50, 60), objArray(51, 62)));
     rootWriter.addRow(
-        new Object[] { new Object[] {110, 120}, new Object[] {111, 121}},
-        new Object[] { new Object[] {130, 140}, new Object[] {131, 142}},
-        new Object[] { new Object[] {150, 160}, new Object[] {151, 162}});
+        objArray(objArray(110, 120), objArray(111, 121)),
+        objArray(objArray(130, 140), objArray(131, 142)),
+        objArray(objArray(150, 160), objArray(151, 162)));
 
     // Verify. Only the projected columns appear in the result set.
 
@@ -376,18 +380,18 @@ public class TestResultSetLoaderProjection extends SubOperatorTest {
       .addMapArray("m1")
         .add("a", MinorType.INT)
         .add("b", MinorType.INT)
-        .buildMap()
+        .resumeSchema()
       .addMapArray("m2")
         .add("d", MinorType.INT)
-        .buildMap()
+        .resumeSchema()
       .build();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
       .addRow(
-          new Object[] { new Object[] {10, 20}, new Object[] {11, 21}},
-          new Object[] { new Object[] {40}, new Object[] {42}})
+          objArray(objArray(10, 20), objArray(11, 21)),
+          objArray(objArray(40), objArray(42)))
       .addRow(
-          new Object[] { new Object[] {110, 120}, new Object[] {111, 121}},
-          new Object[] { new Object[] {140}, new Object[] {142}})
+          objArray(objArray(110, 120), objArray(111, 121)),
+          objArray(objArray(140), objArray(142)))
       .build();
     new RowSetComparison(expected)
         .verifyAndClearAll(fixture.wrap(rsLoader.harvest()));

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProtocol.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProtocol.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProtocol.java
index 1c4082b..352ab34 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProtocol.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderProtocol.java
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -42,7 +43,7 @@ import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**
@@ -440,8 +441,8 @@ public class TestResultSetLoaderProtocol extends SubOperatorTest {
     RowSet result = fixture.wrap(rsLoader.harvest());
     assertEquals(5, rsLoader.schemaVersion());
     SingleRowSet expected = fixture.rowSetBuilder(result.batchSchema())
-        .addRow("foo", "second", "",    null,  new String[] { } )
-        .addRow("bar", "",       "c.2", "d.2", new String[] {"e1", "e2", "e3"} )
+        .addRow("foo", "second", "",    null,  strArray())
+        .addRow("bar", "",       "c.2", "d.2", strArray("e1", "e2", "e3"))
         .build();
     new RowSetComparison(expected)
         .verifyAndClearAll(result);

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderTorture.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderTorture.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderTorture.java
index 22a42f6..cc2a83e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderTorture.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetLoaderTorture.java
@@ -39,7 +39,7 @@ import org.apache.drill.test.LogFixture.LogFixtureBuilder;
 import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 import com.google.common.base.Charsets;
@@ -384,9 +384,9 @@ public class TestResultSetLoaderTorture extends SubOperatorTest {
             .addMap("m3")
               .addNullable("n3", MinorType.INT)
               .addArray("s3", MinorType.VARCHAR)
-              .buildMap()
-            .buildMap()
-          .buildMap()
+              .resumeMap()
+            .resumeMap()
+          .resumeSchema()
         .buildSchema();
     ResultSetLoaderImpl.ResultSetOptions options = new OptionBuilder()
         .setRowCountLimit(ValueVector.MAX_ROW_COUNT)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetSchemaChange.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetSchemaChange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetSchemaChange.java
index 9787189..bb276ec 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetSchemaChange.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/rowSet/impl/TestResultSetSchemaChange.java
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.physical.rowSet.impl;
 
+import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -35,7 +36,7 @@ import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetComparison;
 import org.apache.drill.test.rowSet.RowSetReader;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 public class TestResultSetSchemaChange extends SubOperatorTest {
@@ -136,16 +137,16 @@ public class TestResultSetSchemaChange extends SubOperatorTest {
         .addArray("f", MinorType.VARCHAR)
         .build();
     SingleRowSet expected = fixture.rowSetBuilder(expectedSchema)
-        .addRow("a_1", null, null,   "",       0, new String[] {})
-        .addRow("a_2", null, null,   "",       0, new String[] {})
-        .addRow("a_3",    3, null,   "",       0, new String[] {})
-        .addRow("a_4",    4, null,   "",       0, new String[] {})
-        .addRow("a_5",    5, "c_5",  "",       0, new String[] {})
-        .addRow("a_6",    6, "c_6",  "",       0, new String[] {})
-        .addRow("a_7",    7, "c_7",  "d_7",   70, new String[] {})
-        .addRow("a_8",    8, "c_8",  "d_8",   80, new String[] {})
-        .addRow("a_9",    9, "c_9",  "d_9",   90, new String[] {"f_9-1",  "f_9-2"})
-        .addRow("a_10",  10, "c_10", "d_10", 100, new String[] {"f_10-1", "f_10-2"})
+        .addRow("a_1", null, null,   "",       0, strArray())
+        .addRow("a_2", null, null,   "",       0, strArray())
+        .addRow("a_3",    3, null,   "",       0, strArray())
+        .addRow("a_4",    4, null,   "",       0, strArray())
+        .addRow("a_5",    5, "c_5",  "",       0, strArray())
+        .addRow("a_6",    6, "c_6",  "",       0, strArray())
+        .addRow("a_7",    7, "c_7",  "d_7",   70, strArray())
+        .addRow("a_8",    8, "c_8",  "d_8",   80, strArray())
+        .addRow("a_9",    9, "c_9",  "d_9",   90, strArray("f_9-1",  "f_9-2"))
+        .addRow("a_10",  10, "c_10", "d_10", 100, strArray("f_10-1", "f_10-2"))
         .build();
 
     new RowSetComparison(expected)

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestMiniPlan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestMiniPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestMiniPlan.java
index e6ddc87..f75a85b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestMiniPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestMiniPlan.java
@@ -30,7 +30,7 @@ import org.apache.drill.exec.physical.config.UnionAll;
 import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestNullInputMiniPlan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestNullInputMiniPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestNullInputMiniPlan.java
index c8dcd28..539434b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestNullInputMiniPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/TestNullInputMiniPlan.java
@@ -39,7 +39,7 @@ import org.apache.drill.exec.planner.physical.AggPrelBase;
 import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordBatchSizer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordBatchSizer.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordBatchSizer.java
index 0490406..f32dba3 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordBatchSizer.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestRecordBatchSizer.java
@@ -19,6 +19,7 @@ package org.apache.drill.exec.record;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.exec.record.RecordBatchSizer.ColumnSize;
 import org.apache.drill.exec.vector.NullableVector;
@@ -32,7 +33,7 @@ import org.apache.drill.test.SubOperatorTest;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
 import org.apache.drill.test.rowSet.RowSetBuilder;
-import org.apache.drill.test.rowSet.SchemaBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 public class TestRecordBatchSizer extends SubOperatorTest {
@@ -68,7 +69,7 @@ public class TestRecordBatchSizer extends SubOperatorTest {
     RowSetBuilder builder = fixture.rowSetBuilder(schema);
 
     for (long i = 0; i < 10; i++) {
-      builder.addRow(i, (float) i * 0.1);
+      builder.addRow(i, i * 0.1);
     }
     RowSet rows = builder.build();
 
@@ -127,7 +128,7 @@ public class TestRecordBatchSizer extends SubOperatorTest {
     RowSetBuilder builder = fixture.rowSetBuilder(schema);
 
     for (long i = 0; i < 10; i++) {
-      builder.addRow(new long[] {1, 2, 3, 4, 5}, new double[] {(double)i*0.1, (double)i*0.1, (double)i*0.1, (double)i*0.2, (double)i*0.3});
+      builder.addRow(new long[] {1, 2, 3, 4, 5}, new double[] {i*0.1, i*0.1, i*0.1, i*0.2, i*0.3});
     }
     RowSet rows = builder.build();
 
@@ -200,7 +201,7 @@ public class TestRecordBatchSizer extends SubOperatorTest {
     RowSetBuilder builder = fixture.rowSetBuilder(schema);
 
     for (long i = 0; i < 10; i++) {
-      builder.addRow(i, (float)i*0.1);
+      builder.addRow(i, i*0.1);
     }
 
     RowSet rows = builder.build();
@@ -506,7 +507,7 @@ public class TestRecordBatchSizer extends SubOperatorTest {
       .addMap("map")
         .add("key", MinorType.INT)
         .add("value", MinorType.VARCHAR)
-      .buildMap()
+      .resumeSchema()
       .build();
 
     RowSetBuilder builder = fixture.rowSetBuilder(schema);
@@ -589,7 +590,7 @@ public class TestRecordBatchSizer extends SubOperatorTest {
     BatchSchema schema = new SchemaBuilder().addMapArray("map").
       add("key", MinorType.INT).
       add("value", MinorType.VARCHAR).
-      buildMap().build();
+      resumeSchema().build();
 
     RowSetBuilder builder = fixture.rowSetBuilder(schema);
 
@@ -694,8 +695,8 @@ public class TestRecordBatchSizer extends SubOperatorTest {
         .addMap("childMap")
           .add("childKey", MinorType.INT)
           .add("childValue", MinorType.VARCHAR)
-          .buildMap()
-       .buildMap()
+          .resumeMap()
+       .resumeSchema()
       .build();
 
     RowSetBuilder builder = fixture.rowSetBuilder(schema);

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestTupleSchema.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestTupleSchema.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestTupleSchema.java
index 83bdcaf..45f6031 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestTupleSchema.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestTupleSchema.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
@@ -34,6 +35,7 @@ import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode;
 import org.apache.drill.exec.record.metadata.ColumnMetadata;
+import org.apache.drill.exec.record.metadata.ColumnMetadata.StructureType;
 import org.apache.drill.exec.record.metadata.MapColumnMetadata;
 import org.apache.drill.exec.record.metadata.MetadataUtils;
 import org.apache.drill.exec.record.metadata.PrimitiveColumnMetadata;
@@ -42,8 +44,8 @@ import org.apache.drill.exec.record.metadata.TupleSchema;
 import org.apache.drill.exec.record.metadata.VariantColumnMetadata;
 import org.apache.drill.exec.record.metadata.VariantMetadata;
 import org.apache.drill.test.SubOperatorTest;
-import org.apache.drill.test.rowSet.SchemaBuilder;
-import org.apache.drill.test.rowSet.SchemaBuilder.ColumnBuilder;
+import org.apache.drill.test.rowSet.schema.ColumnBuilder;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.junit.Test;
 
 /**
@@ -680,4 +682,149 @@ public class TestTupleSchema extends SubOperatorTest {
 
     assertTrue(colA.schema().isEquivalent(fieldA));
   }
+
+  @Test
+  public void testUnionSchema() {
+    TupleMetadata schema = new SchemaBuilder()
+        .addUnion("u")
+          .addType(MinorType.BIGINT)
+          .addType(MinorType.VARCHAR)
+          .resumeSchema()
+        .buildSchema();
+
+    assertEquals(1, schema.size());
+    ColumnMetadata col = schema.metadata(0);
+    assertTrue(col instanceof VariantColumnMetadata);
+    assertEquals(MinorType.UNION, col.type());
+    assertEquals(DataMode.OPTIONAL, col.mode());
+    assertTrue(col.isNullable());
+    assertFalse(col.isArray());
+    assertTrue(col.isVariant());
+    assertEquals(StructureType.VARIANT, col.structureType());
+
+    VariantMetadata union = col.variantSchema();
+    assertNotNull(union);
+    assertEquals(2, union.size());
+    assertTrue(union.hasType(MinorType.BIGINT));
+    assertTrue(union.hasType(MinorType.VARCHAR));
+    assertFalse(union.hasType(MinorType.INT));
+    Collection<MinorType> types = union.types();
+    assertNotNull(types);
+    assertEquals(2, types.size());
+    assertTrue(types.contains(MinorType.BIGINT));
+    assertTrue(types.contains(MinorType.VARCHAR));
+
+    BatchSchema batchSchema = ((TupleSchema) schema).toBatchSchema(SelectionVectorMode.NONE);
+
+    MaterializedField field = batchSchema.getColumn(0);
+    assertEquals("u", field.getName());
+    MajorType majorType = field.getType();
+    assertEquals(MinorType.UNION, majorType.getMinorType());
+    assertEquals(DataMode.OPTIONAL, majorType.getMode());
+    assertEquals(2, majorType.getSubTypeCount());
+    List<MinorType> subtypes = majorType.getSubTypeList();
+    assertEquals(2, subtypes.size());
+    assertTrue(subtypes.contains(MinorType.BIGINT));
+    assertTrue(subtypes.contains(MinorType.VARCHAR));
+  }
+
+  @Test
+  public void testListSchema() {
+    TupleMetadata schema = new SchemaBuilder()
+        .addList("list")
+          .addType(MinorType.BIGINT)
+          .addType(MinorType.VARCHAR)
+          .resumeSchema()
+        .buildSchema();
+
+    assertEquals(1, schema.size());
+    ColumnMetadata col = schema.metadata(0);
+    assertTrue(col instanceof VariantColumnMetadata);
+
+    // Implementation shows through here: actual major
+    // type is (LIST, OPTIONAL) even though the metadata
+    // lies that this is a variant array.
+
+    assertEquals(MinorType.LIST, col.type());
+    assertEquals(DataMode.OPTIONAL, col.mode());
+    assertTrue(col.isNullable());
+    assertTrue(col.isArray());
+    assertTrue(col.isVariant());
+    assertEquals(StructureType.VARIANT, col.structureType());
+
+    VariantMetadata union = col.variantSchema();
+    assertNotNull(union);
+    assertEquals(2, union.size());
+    assertTrue(union.hasType(MinorType.BIGINT));
+    assertTrue(union.hasType(MinorType.VARCHAR));
+    assertFalse(union.hasType(MinorType.INT));
+    Collection<MinorType> types = union.types();
+    assertNotNull(types);
+    assertEquals(2, types.size());
+    assertTrue(types.contains(MinorType.BIGINT));
+    assertTrue(types.contains(MinorType.VARCHAR));
+
+    BatchSchema batchSchema = ((TupleSchema) schema).toBatchSchema(SelectionVectorMode.NONE);
+
+    MaterializedField field = batchSchema.getColumn(0);
+    assertEquals("list", field.getName());
+    MajorType majorType = field.getType();
+    assertEquals(MinorType.LIST, majorType.getMinorType());
+    assertEquals(DataMode.OPTIONAL, majorType.getMode());
+    assertEquals(2, majorType.getSubTypeCount());
+    List<MinorType> subtypes = majorType.getSubTypeList();
+    assertEquals(2, subtypes.size());
+    assertTrue(subtypes.contains(MinorType.BIGINT));
+    assertTrue(subtypes.contains(MinorType.VARCHAR));
+  }
+
+  @Test
+  public void testNestedSchema() {
+    TupleMetadata schema = new SchemaBuilder()
+        .addList("list")
+          .addType(MinorType.BIGINT)
+          .addType(MinorType.VARCHAR)
+          .addMap()
+            .add("a", MinorType.INT)
+            .add("b", MinorType.VARCHAR)
+            .resumeUnion()
+          .addList()
+            .addType(MinorType.FLOAT8)
+            .addType(MinorType.DECIMAL18)
+            .buildNested()
+          .resumeSchema()
+        .buildSchema();
+
+    assertEquals(1, schema.size());
+    ColumnMetadata col = schema.metadata(0);
+    assertTrue(col.isVariant());
+    VariantMetadata union = col.variantSchema();
+    assertNotNull(union);
+    assertEquals(4, union.size());
+    assertTrue(union.hasType(MinorType.MAP));
+    assertTrue(union.hasType(MinorType.LIST));
+
+    ColumnMetadata mapCol = union.member(MinorType.MAP);
+    TupleMetadata mapSchema = mapCol.mapSchema();
+    assertEquals(2, mapSchema.size());
+
+    ColumnMetadata listCol = union.member(MinorType.LIST);
+    VariantMetadata listSchema = listCol.variantSchema();
+    assertEquals(2, listSchema.size());
+    assertTrue(listSchema.hasType(MinorType.FLOAT8));
+    assertTrue(listSchema.hasType(MinorType.DECIMAL18));
+  }
+
+  @Test
+  public void testDuplicateType() {
+    try {
+      new SchemaBuilder()
+          .addList("list")
+            .addType(MinorType.BIGINT)
+            .addType(MinorType.BIGINT);
+      fail();
+    } catch (IllegalArgumentException e) {
+      // Expected
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/f653359c/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestVectorContainer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestVectorContainer.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestVectorContainer.java
index c6c18d5..a511a0a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestVectorContainer.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestVectorContainer.java
@@ -26,8 +26,8 @@ import org.apache.drill.test.OperatorFixture;
 import org.apache.drill.test.rowSet.DirectRowSet;
 import org.apache.drill.test.rowSet.RowSet;
 import org.apache.drill.test.rowSet.RowSet.SingleRowSet;
+import org.apache.drill.test.rowSet.schema.SchemaBuilder;
 import org.apache.drill.test.rowSet.RowSetComparison;
-import org.apache.drill.test.rowSet.SchemaBuilder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;


Mime
View raw message