drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adene...@apache.org
Subject [2/2] drill git commit: DRILL-3930: Remove direct references to TopLevelAllocator from unit tests Ensure RootAllocatorFactory is used throughout the code so that we can change allocators via configuration or software. Use DrillAutoCloseables to handle ex
Date Thu, 15 Oct 2015 13:13:12 GMT
DRILL-3930: Remove direct references to TopLevelAllocator from unit tests
Ensure RootAllocatorFactory is used throughout the code so
that we can change allocators via configuration or software. Use
DrillAutoCloseables to handle exceptions that could happen from some
allocator close() calls when the allocator is in an improper state.

this closes #200


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

Branch: refs/heads/master
Commit: 12fb9ac11e25a2bbd9fff5d9cdb6a355b96ffadb
Parents: 8c09835
Author: Chris Westin <cwestin@yahoo.com>
Authored: Tue Oct 13 13:49:57 2015 -0700
Committer: adeneche <adeneche@gmail.com>
Committed: Wed Oct 14 18:01:38 2015 -0700

----------------------------------------------------------------------
 .../exec/physical/impl/TestOptiqPlans.java      |  4 +-
 .../drill/exec/physical/impl/agg/TestAgg.java   |  3 -
 .../physical/impl/common/TestHashTable.java     |  1 -
 .../impl/mergereceiver/TestMergingReceiver.java | 84 ++++++--------------
 .../impl/project/TestSimpleProjection.java      |  1 -
 .../impl/trace/TestTraceMultiRecordBatch.java   |  1 -
 .../exec/server/TestDrillbitResilience.java     |  5 +-
 .../exec/store/TestDirectCodecFactory.java      |  2 +-
 .../drill/exec/vector/TestSplitAndTransfer.java | 26 +++---
 .../vector/complex/writer/TestRepeated.java     | 18 ++---
 10 files changed, 53 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
index f2f2f0d..8042167 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
@@ -138,7 +138,7 @@ public class TestOptiqPlans extends ExecTest {
           final ValueVector vv = vw.getValueVector();
           for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
             final Object o = vv.getAccessor().getObject(i);
-            System.out.println(vv.getAccessor().getObject(i));
+            System.out.println(o);
           }
         }
         loader.clear();
@@ -167,7 +167,7 @@ public class TestOptiqPlans extends ExecTest {
           final ValueVector vv = vw.getValueVector();
           for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
             final Object o = vv.getAccessor().getObject(i);
-            System.out.println(vv.getAccessor().getObject(i));
+            System.out.println(o);
           }
         }
         loader.clear();

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/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 bf1f064..e00ff29 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
@@ -29,7 +29,6 @@ import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.compile.CodeCompiler;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.memory.RootAllocatorFactory;
-import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.physical.base.FragmentRoot;
@@ -128,7 +127,5 @@ public class TestAgg extends ExecTest {
       throw exec.getContext().getFailureCause();
     }
     assertTrue(!exec.getContext().isFailed());
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/common/TestHashTable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/common/TestHashTable.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/common/TestHashTable.java
index 84b652e..6e3732f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/common/TestHashTable.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/common/TestHashTable.java
@@ -31,7 +31,6 @@ import org.apache.drill.exec.compile.CodeCompiler;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.expr.holders.IntHolder;
 import org.apache.drill.exec.memory.RootAllocatorFactory;
-import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.physical.base.FragmentRoot;

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
index f57d7a9..80bf17e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
@@ -26,11 +26,14 @@ import java.util.List;
 import org.apache.drill.common.util.FileUtils;
 import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.pop.PopUnitTestBase;
+import org.apache.drill.exec.proto.UserBitShared.QueryData;
+import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.RecordBatchLoader;
 import org.apache.drill.exec.record.VectorWrapper;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.apache.drill.exec.server.Drillbit;
 import org.apache.drill.exec.server.RemoteServiceSet;
+import org.apache.drill.exec.vector.ValueVector;
 import org.junit.Test;
 
 import com.google.common.base.Charsets;
@@ -57,26 +60,10 @@ public class TestMergingReceiver extends PopUnitTestBase {
       final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
       // print the results
       for (final QueryDataBatch b : results) {
-        count += b.getHeader().getRowCount();
-        for (int valueIdx = 0; valueIdx < b.getHeader().getRowCount(); valueIdx++) {
-          final List<Object> row = Lists.newArrayList();
-          batchLoader.load(b.getHeader().getDef(), b.getData());
-          for (final VectorWrapper<?> vw : batchLoader) {
-            row.add(vw.getValueVector().getField().toExpr() + ":" + vw.getValueVector().getAccessor().getObject(valueIdx));
-          }
-          for (final Object cell : row) {
-            if (cell == null) {
-//              System.out.print("<null>    ");
-              continue;
-            }
-            final int len = cell.toString().length();
-//            System.out.print(cell + " ");
-            for (int i = 0; i < (30 - len); ++i) {
-//              System.out.print(" ");
-            }
-          }
-//          System.out.println();
-        }
+        final QueryData queryData = b.getHeader();
+        final int rowCount = queryData.getRowCount();
+        count += rowCount;
+        batchLoader.load(queryData.getDef(), b.getData()); // loaded but not used, just to
test
         b.release();
         batchLoader.clear();
       }
@@ -104,31 +91,25 @@ public class TestMergingReceiver extends PopUnitTestBase {
       // print the results
       Long lastBlueValue = null;
       for (final QueryDataBatch b : results) {
-        count += b.getHeader().getRowCount();
-        for (int valueIdx = 0; valueIdx < b.getHeader().getRowCount(); valueIdx++) {
-          final List<Object> row = Lists.newArrayList();
-          batchLoader.load(b.getHeader().getDef(), b.getData());
-          for (final VectorWrapper vw : batchLoader) {
-            row.add(vw.getValueVector().getField().toExpr() + ":" + vw.getValueVector().getAccessor().getObject(valueIdx));
-            if (vw.getValueVector().getField().getAsSchemaPath().getRootSegment().getPath().equals("blue"))
{
+        final QueryData queryData = b.getHeader();
+        final int batchRowCount = queryData.getRowCount();
+        count += batchRowCount;
+        batchLoader.load(queryData.getDef(), b.getData());
+        for (final VectorWrapper vw : batchLoader) {
+          final ValueVector vv = vw.getValueVector();
+          final ValueVector.Accessor va = vv.getAccessor();
+          final MaterializedField materializedField = vv.getField();
+          final int numValues = va.getValueCount();
+          for(int valueIdx = 0; valueIdx < numValues; ++valueIdx) {
+            if (materializedField.getAsSchemaPath().getRootSegment().getPath().equals("blue"))
{
+              final long longValue = ((Long) va.getObject(valueIdx)).longValue();
               // check that order is ascending
-              if (((Long)vw.getValueVector().getAccessor().getObject(valueIdx)).longValue()
== 0) {
-                continue; // ignore initial 0's from sort
-              }
               if (lastBlueValue != null) {
-                assertTrue(((Long)vw.getValueVector().getAccessor().getObject(valueIdx)).longValue()
>= ((Long)lastBlueValue).longValue());
+                assertTrue(longValue >= lastBlueValue);
               }
-              lastBlueValue = (Long)vw.getValueVector().getAccessor().getObject(valueIdx);
+              lastBlueValue = longValue;
             }
           }
-          for (final Object cell : row) {
-            int len = cell.toString().length();
-//            System.out.print(cell + " ");
-            for (int i = 0; i < (30 - len); ++i) {
-//              System.out.print(" ");
-            }
-          }
-//          System.out.println();
         }
         b.release();
         batchLoader.clear();
@@ -156,26 +137,9 @@ public class TestMergingReceiver extends PopUnitTestBase {
       final RecordBatchLoader batchLoader = new RecordBatchLoader(client.getAllocator());
       // print the results
       for (final QueryDataBatch b : results) {
-        count += b.getHeader().getRowCount();
-        for (int valueIdx = 0; valueIdx < b.getHeader().getRowCount(); valueIdx++) {
-          final List<Object> row = Lists.newArrayList();
-          batchLoader.load(b.getHeader().getDef(), b.getData());
-          for (final VectorWrapper vw : batchLoader) {
-            row.add(vw.getValueVector().getField().toExpr() + ":" + vw.getValueVector().getAccessor().getObject(valueIdx));
-          }
-          for (final Object cell : row) {
-            if (cell == null) {
-//              System.out.print("<null>    ");
-              continue;
-            }
-            int len = cell.toString().length();
-//            System.out.print(cell + " ");
-            for (int i = 0; i < (30 - len); ++i) {
-//              System.out.print(" ");
-            }
-          }
-//          System.out.println();
-        }
+        final QueryData queryData = b.getHeader();
+        batchLoader.load(queryData.getDef(), b.getData()); // loaded but not used, for testing
+        count += queryData.getRowCount();
         b.release();
         batchLoader.clear();
       }

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
index e8cf7fe..2ba7280 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/project/TestSimpleProjection.java
@@ -30,7 +30,6 @@ import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.compile.CodeCompiler;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.memory.RootAllocatorFactory;
-import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.physical.base.FragmentRoot;

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
index a02f3b5..bd4c01f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/trace/TestTraceMultiRecordBatch.java
@@ -27,7 +27,6 @@ import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.compile.CodeCompiler;
 import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry;
 import org.apache.drill.exec.memory.RootAllocatorFactory;
-import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.ops.FragmentContext;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.physical.base.FragmentRoot;

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
index c4a1a76..2a1bb22 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
@@ -36,6 +36,7 @@ import org.apache.drill.QueryTestUtil;
 import org.apache.drill.SingleRowListener;
 import org.apache.drill.common.AutoCloseables;
 import org.apache.drill.common.concurrent.ExtendedLatch;
+import org.apache.drill.common.DrillAutoCloseables;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.exceptions.UserException;
 import org.apache.drill.common.types.TypeProtos.MinorType;
@@ -119,7 +120,6 @@ public class TestDrillbitResilience extends DrillTest {
     }
 
     try {
-      @SuppressWarnings("resource")
       final Drillbit drillbit = Drillbit.start(zkHelper.getConfig(), remoteServiceSet);
       drillbits.put(name, drillbit);
     } catch (final DrillbitStartupException e) {
@@ -133,7 +133,6 @@ public class TestDrillbitResilience extends DrillTest {
    * @param name name of the drillbit
    */
   private static void stopDrillbit(final String name) {
-    @SuppressWarnings("resource")
     final Drillbit drillbit = drillbits.get(name);
     if (drillbit == null) {
       throw new IllegalStateException("No Drillbit named \"" + name + "\" found");
@@ -273,7 +272,7 @@ public class TestDrillbitResilience extends DrillTest {
 
           @Override
           public void cleanup() {
-            bufferAllocator.close();
+            DrillAutoCloseables.closeNoChecked(bufferAllocator);
           }
         };
 

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestDirectCodecFactory.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestDirectCodecFactory.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestDirectCodecFactory.java
index 3c5cbf7..004a8d0 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestDirectCodecFactory.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestDirectCodecFactory.java
@@ -46,7 +46,7 @@ public class TestDirectCodecFactory extends ExecTest {
     ON_HEAP, OFF_HEAP, DRILLBUF
   }
 
-  private void test(int size, CompressionCodecName codec, boolean useOnHeapCompression, Decompression
decomp) {
+  private void test(int size, CompressionCodecName codec, boolean useOnHeapCompression, Decompression
decomp) throws Exception {
     DrillBuf rawBuf = null;
     DrillBuf outBuf = null;
     try (final BufferAllocator allocator = RootAllocatorFactory.newRoot(drillConfig);

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestSplitAndTransfer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestSplitAndTransfer.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestSplitAndTransfer.java
index a0a0898..b2054e6 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestSplitAndTransfer.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestSplitAndTransfer.java
@@ -17,6 +17,10 @@
  */
 package org.apache.drill.exec.vector;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
@@ -25,7 +29,6 @@ import org.apache.drill.exec.memory.RootAllocatorFactory;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.TransferPair;
 import org.apache.drill.exec.vector.NullableVarCharVector.Accessor;
-import org.junit.Assert;
 import org.junit.Test;
 
 public class TestSplitAndTransfer {
@@ -37,21 +40,23 @@ public class TestSplitAndTransfer {
     final NullableVarCharVector varCharVector = new NullableVarCharVector(field, allocator);
     varCharVector.allocateNew(10000, 1000);
 
-    final String[] compareArray = new String[500];
+    final int valueCount = 500;
+    final String[] compareArray = new String[valueCount];
 
-    for (int i = 0; i < 500; i += 3) {
+    final NullableVarCharVector.Mutator mutator = varCharVector.getMutator();
+    for (int i = 0; i < valueCount; i += 3) {
       final String s = String.format("%010d", i);
-      varCharVector.getMutator().set(i, s.getBytes());
+      mutator.set(i, s.getBytes());
       compareArray[i] = s;
     }
-    varCharVector.getMutator().setValueCount(500);
+    mutator.setValueCount(valueCount);
 
     final TransferPair tp = varCharVector.getTransferPair();
     final NullableVarCharVector newVarCharVector = (NullableVarCharVector) tp.getTo();
     final Accessor accessor = newVarCharVector.getAccessor();
     final int[][] startLengths = {{0, 201}, {201, 200}, {401, 99}};
 
-    for (int[] startLength : startLengths) {
+    for (final int[] startLength : startLengths) {
       final int start = startLength[0];
       final int length = startLength[1];
       tp.splitAndTransfer(start, length);
@@ -60,17 +65,16 @@ public class TestSplitAndTransfer {
         final boolean expectedSet = ((start + i) % 3) == 0;
         if (expectedSet) {
           final byte[] expectedValue = compareArray[start + i].getBytes();
-          Assert.assertFalse(accessor.isNull(i));
-//          System.out.println(new String(accessor.get(i)));
-          Assert.assertArrayEquals(expectedValue, accessor.get(i));
+          assertFalse(accessor.isNull(i));
+          assertArrayEquals(expectedValue, accessor.get(i));
         } else {
-          Assert.assertTrue(accessor.isNull(i));
+          assertTrue(accessor.isNull(i));
         }
       }
       newVarCharVector.clear();
     }
 
-    varCharVector.clear();
+    varCharVector.close();
     allocator.close();
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/12fb9ac1/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
index 023dc08..df0ce14 100644
--- 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
@@ -18,8 +18,8 @@
 package org.apache.drill.exec.vector.complex.writer;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 
+import org.apache.drill.common.DrillAutoCloseables;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.expr.holders.BigIntHolder;
 import org.apache.drill.exec.expr.holders.IntHolder;
@@ -52,7 +52,7 @@ public class TestRepeated {
 
   @AfterClass
   public static void destroyAllocator() {
-    allocator.close();
+    DrillAutoCloseables.closeNoChecked(allocator);
   }
 //
 //  @Test
@@ -114,7 +114,7 @@ public class TestRepeated {
 //  }
 
   @Test
-  public void listOfList() throws IOException {
+  public void listOfList() throws Exception {
     /**
      * We're going to try to create an object that looks like:
      *
@@ -132,8 +132,8 @@ public class TestRepeated {
      *
      */
 
-    final MapVector v = new MapVector("", allocator, null);
-    final ComplexWriterImpl writer = new ComplexWriterImpl("col", v);
+    final MapVector mapVector = new MapVector("", allocator, null);
+    final ComplexWriterImpl writer = new ComplexWriterImpl("col", mapVector);
     writer.allocate();
 
     {
@@ -242,12 +242,12 @@ public class TestRepeated {
 
     final 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)));
+    System.out.println("Map of Object[0]: " + ow.writeValueAsString(mapVector.getAccessor().getObject(0)));
+    System.out.println("Map of Object[1]: " + ow.writeValueAsString(mapVector.getAccessor().getObject(1)));
 
     final ByteArrayOutputStream stream = new ByteArrayOutputStream();
     final JsonWriter jsonWriter = new JsonWriter(stream, true, true);
-    final FieldReader reader = v.getChild("col", MapVector.class).getReader();
+    final FieldReader reader = mapVector.getChild("col", MapVector.class).getReader();
     reader.setPosition(0);
     jsonWriter.write(reader);
     reader.setPosition(1);
@@ -255,6 +255,6 @@ public class TestRepeated {
     System.out.print("Json Read: ");
     System.out.println(new String(stream.toByteArray(), Charsets.UTF_8));
 
-    writer.clear();
+    writer.close();
   }
 }


Mime
View raw message