Fix tests that have extraneous warnings, move VectorContainer from warning to exception when wrong vector type is requested.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/c0927ea4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/c0927ea4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/c0927ea4 Branch: refs/heads/master Commit: c0927ea4b9340794b313eabb85060382c4d01995 Parents: 3cbcfaa Author: Jacques Nadeau <[email protected]> Authored: Tue May 6 14:40:40 2014 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Tue May 6 14:40:40 2014 -0700 ---------------------------------------------------------------------- .../drill/exec/record/VectorContainer.java | 3 +- .../exec/fn/impl/TestAggregateFunction.java | 35 ++------------ .../physical/impl/TestCastVarCharToBigInt.java | 33 ++----------- .../drill/exec/physical/impl/TestDecimal.java | 14 ------ .../exec/physical/impl/join/TestHashJoin.java | 49 ++++---------------- .../drill/exec/record/vector/TestDateTypes.java | 10 ---- 6 files changed, 17 insertions(+), 127 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java index 17fdc1e..25289a8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java @@ -147,10 +147,9 @@ public class VectorContainer implements Iterable<VectorWrapper<?>>, VectorAccess return (VectorWrapper<?>) va; } if (va != null && va.getVectorClass() != clazz) { - logger.warn(String.format( + throw new IllegalStateException(String.format( "Failure while reading vector. Expected vector class of %s but was holding vector class %s.", clazz.getCanonicalName(), va.getVectorClass().getCanonicalName())); - return null; } return (VectorWrapper<?>) va; } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java index 8d8b0eb..1159982 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestAggregateFunction.java @@ -17,53 +17,26 @@ */ package org.apache.drill.exec.fn.impl; -import org.apache.drill.exec.pop.PopUnitTestBase; -import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -import mockit.Injectable; -import mockit.NonStrictExpectations; +import java.util.List; -import org.apache.drill.common.config.DrillConfig; -import org.apache.drill.common.expression.ExpressionPosition; -import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; -import org.apache.drill.exec.memory.BufferAllocator; -import org.apache.drill.exec.memory.TopLevelAllocator; -import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.PhysicalPlan; -import org.apache.drill.exec.physical.base.FragmentRoot; -import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry; -import org.apache.drill.exec.physical.impl.ImplCreator; -import org.apache.drill.exec.physical.impl.SimpleRootExec; -import org.apache.drill.exec.planner.PhysicalPlanReader; import org.apache.drill.exec.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.BitControl; -import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.rpc.user.QueryResultBatch; -import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.Drillbit; -import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.server.RemoteServiceSet; -import org.apache.drill.exec.vector.BigIntVector; -import org.apache.drill.exec.vector.Float8Vector; - +import org.apache.drill.exec.vector.NullableBigIntVector; import org.apache.drill.exec.vector.ValueVector; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; - -import java.util.Iterator; -import java.util.List; public class TestAggregateFunction extends PopUnitTestBase { @Test @@ -91,8 +64,6 @@ public class TestAggregateFunction extends PopUnitTestBase { 4.571428571428571d, 4.571428571428571d}; - batchLoader.getValueAccessorById(0, BigIntVector.class); - int i = 0; for (VectorWrapper<?> v : batchLoader) { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java index 44fd235..2dfeb5d 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastVarCharToBigInt.java @@ -17,51 +17,26 @@ */ package org.apache.drill.exec.physical.impl; -import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; -import mockit.Injectable; -import mockit.NonStrictExpectations; +import java.util.List; -import org.apache.drill.common.config.DrillConfig; -import org.apache.drill.common.expression.ExpressionPosition; -import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; -import org.apache.drill.exec.memory.BufferAllocator; -import org.apache.drill.exec.memory.TopLevelAllocator; -import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.PhysicalPlan; -import org.apache.drill.exec.physical.base.FragmentRoot; -import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry; -import org.apache.drill.exec.physical.impl.ImplCreator; -import org.apache.drill.exec.physical.impl.SimpleRootExec; -import org.apache.drill.exec.planner.PhysicalPlanReader; import org.apache.drill.exec.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.BitControl; -import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.rpc.user.QueryResultBatch; -import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.Drillbit; -import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.server.RemoteServiceSet; -import org.apache.drill.exec.vector.BigIntVector; -import org.apache.drill.exec.vector.Float8Vector; - +import org.apache.drill.exec.vector.NullableBigIntVector; import org.apache.drill.exec.vector.ValueVector; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; - -import java.util.List; public class TestCastVarCharToBigInt extends PopUnitTestBase { @@ -86,8 +61,6 @@ public class TestCastVarCharToBigInt extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - for (VectorWrapper<?> v : batchLoader) { ValueVector.Accessor accessor = v.getValueVector().getAccessor(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java index 7820875..48600a0 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestDecimal.java @@ -69,8 +69,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String decimal9Output[] = {"99.0000", "11.1234", "0.1000", "-0.1200", "-123.1234", "-1.0001"}; String decimal18Output[] = {"123456789.000000000", "11.123456789", "0.100000000", "-0.100400000", "-987654321.123456789", "-2.030100000"}; @@ -111,8 +109,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String decimal9Output[] = {"99.0000", "11.1234", "0.1000", "-0.1200", "-123.1234", "-1.0001"}; String decimal38Output[] = {"123456789.0000", "11.1234", "0.1000", "-0.1004", "-987654321.1234", "-2.0301"}; @@ -153,8 +149,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String addOutput[] = {"123456888.0", "22.2", "0.2", "-0.2", "-987654444.2","-3.0"}; String subtractOutput[] = {"123456690.0", "0.0", "0.0", "0.0", "-987654198.0", "-1.0"}; String multiplyOutput[] = {"12222222111.00" , "123.21" , "0.01", "0.01", "121580246927.41", "2.00"}; @@ -201,8 +195,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String addOutput[] = {"-99999998877.700000000", "11.423456789", "123456789.100000000", "-0.119998000", "100000000112.423456789" , "-99999999879.907000000", "123456789123456801.300000000"}; String subtractOutput[] = {"-100000001124.300000000", "10.823456789", "-123456788.900000000", "-0.120002000", "99999999889.823456789", "-100000000122.093000000", "123456789123456776.700000000"}; String multiplyOutput[] = {"-112330000001123.300000000000000000", "3.337037036700000000" , "12345678.900000000000000000", "-0.000000240000000000" , "11130000000125.040740615700000000" , "-12109300000121.093000000000000000", "1518518506218518504.700000000000000000" }; @@ -245,8 +237,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, NullableVarCharVector.class); - String sortOutput[] = {"-100000000001.000000000000", "-100000000001.000000000000", "-145456789.120123000000", @@ -294,8 +284,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String sortOutput[] = {"-100000000001.000000000000", "-100000000001.000000000000", "-0.120000000000", "0.100000000001", "11.123456789012", "100000000001.123456789001", "123456789123456789.000000000000"}; Iterator<VectorWrapper<?>> itr = batchLoader.iterator(); @@ -339,8 +327,6 @@ public class TestDecimal extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, VarCharVector.class); - String output[] = {"99.0000", "11.1234", "0.1000", "-0.1200", "-123.1234", "-1.0001"}; Iterator<VectorWrapper<?>> itr = batchLoader.iterator(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java index 79ce550..722d54f 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoin.java @@ -20,7 +20,7 @@ package org.apache.drill.exec.physical.impl.join; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import mockit.Injectable; @@ -29,59 +29,34 @@ import mockit.NonStrictExpectations; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.util.FileUtils; import org.apache.drill.common.util.TestTools; +import org.apache.drill.exec.client.DrillClient; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; -import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.TopLevelAllocator; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.physical.base.FragmentRoot; -import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry; import org.apache.drill.exec.physical.impl.ImplCreator; +import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry; import org.apache.drill.exec.physical.impl.SimpleRootExec; import org.apache.drill.exec.planner.PhysicalPlanReader; -import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.proto.ExecProtos; -import org.apache.drill.exec.proto.BitControl.PlanFragment; -import org.apache.drill.exec.rpc.user.UserServer; -import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; -import org.apache.drill.exec.server.DrillbitContext; -import org.apache.drill.exec.store.StoragePluginRegistry; -import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; -import org.junit.Rule; -import org.junit.Test; - -import com.beust.jcommander.internal.Lists; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.Iterator; -import java.util.List; - -import org.apache.drill.common.config.DrillConfig; -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.BitControl.PlanFragment; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.rpc.user.QueryResultBatch; +import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.Drillbit; +import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.server.RemoteServiceSet; +import org.apache.drill.exec.vector.NullableIntVector; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.VarCharVector; -import org.apache.drill.exec.vector.IntVector; -import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestName; import org.junit.rules.TestRule; -import org.junit.rules.Timeout; +import com.codahale.metrics.MetricRegistry; import com.google.common.base.Charsets; import com.google.common.io.Files; @@ -162,8 +137,6 @@ public class TestHashJoin extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, IntVector.class); - Iterator<VectorWrapper<?>> itr = batchLoader.iterator(); // Just test the join key @@ -228,8 +201,6 @@ public class TestHashJoin extends PopUnitTestBase{ QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, IntVector.class); - Iterator<VectorWrapper<?>> itr = batchLoader.iterator(); // Just test the join key http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c0927ea4/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java index 544a4d2..5d6a37f 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java @@ -89,8 +89,6 @@ public class TestDateTypes extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - for (VectorWrapper<?> v : batchLoader) { ValueVector.Accessor accessor = v.getValueVector().getAccessor(); @@ -125,8 +123,6 @@ public class TestDateTypes extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - for (VectorWrapper<?> v : batchLoader) { ValueVector.Accessor accessor = v.getValueVector().getAccessor(); @@ -161,8 +157,6 @@ public class TestDateTypes extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - for (VectorWrapper<?> v : batchLoader) { ValueVector.Accessor accessor = v.getValueVector().getAccessor(); @@ -254,8 +248,6 @@ public class TestDateTypes extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - String result[] = {"2008-02-27", "2008-02-27 01:02:03.000", "2008-02-27 01:02:03.000 UTC", @@ -296,8 +288,6 @@ public class TestDateTypes extends PopUnitTestBase { QueryResultBatch batch = results.get(0); assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData())); - batchLoader.getValueAccessorById(0, BigIntVector.class); - for (VectorWrapper<?> v : batchLoader) { ValueVector.Accessor accessor = v.getValueVector().getAccessor();
