diff options
author | Aditya Kishore <aditya@maprtech.com> | 2014-09-09 13:26:06 -0700 |
---|---|---|
committer | Aditya Kishore <aditya@maprtech.com> | 2014-09-11 19:24:11 -0700 |
commit | 39990292e833bbfb419565a3503312c552110378 (patch) | |
tree | 6c1e527a082b7801162fa727b8a5d26f06c6072f /exec/java-exec | |
parent | 20d2aa46e2b789d5fe09b1383ec559b4aa8f5316 (diff) |
DRILL-634: Cleanup/organize Java imports and trailing whitespaces from Drill code
Diffstat (limited to 'exec/java-exec')
643 files changed, 2123 insertions, 2658 deletions
diff --git a/exec/java-exec/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java b/exec/java-exec/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java index 86d3b5930..2cca5d76a 100644 --- a/exec/java-exec/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java +++ b/exec/java-exec/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java @@ -22,8 +22,6 @@ import io.netty.util.internal.PlatformDependent; import java.nio.ByteOrder; -import org.apache.drill.exec.memory.BufferAllocator; - public final class UnsafeDirectLittleEndian extends WrappedByteBuf { private static final boolean NATIVE_ORDER = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN; private final PooledUnsafeDirectByteBuf wrapped; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedCache.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedCache.java index 1c5de85b1..1e0c9852c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedCache.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedCache.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.cache; -import java.util.Map; - import org.apache.drill.exec.exception.DrillbitStartupException; import com.google.protobuf.Message; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedMultiMap.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedMultiMap.java index 214a8712a..301f03865 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedMultiMap.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedMultiMap.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.cache; import java.util.Collection; -import java.util.List; import java.util.concurrent.Future; public interface DistributedMultiMap<K, V> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java index 83b3d5a8e..fc9775ca7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.cache; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; import java.io.IOException; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/JacksonAdvancedExternalizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/JacksonAdvancedExternalizer.java index 63a6d6238..55633ab21 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/JacksonAdvancedExternalizer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/JacksonAdvancedExternalizer.java @@ -23,13 +23,10 @@ import java.io.ObjectOutput; import java.util.Collections; import java.util.Set; -import org.apache.drill.common.util.DataInputInputStream; import org.apache.drill.exec.cache.SerializationDefinition; import org.infinispan.commons.marshall.AdvancedExternalizer; import com.fasterxml.jackson.databind.ObjectMapper; -import com.hazelcast.nio.ObjectDataInput; -import com.hazelcast.nio.ObjectDataOutput; public class JacksonAdvancedExternalizer<T> implements AdvancedExternalizer<T> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JacksonAdvancedExternalizer.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/ProtobufAdvancedExternalizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/ProtobufAdvancedExternalizer.java index df97a014d..7b638ee38 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/ProtobufAdvancedExternalizer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/ProtobufAdvancedExternalizer.java @@ -25,7 +25,6 @@ import java.util.Set; import org.apache.drill.common.util.DataInputInputStream; import org.apache.drill.exec.cache.SerializationDefinition; -import org.apache.drill.exec.proto.UserBitShared.QueryProfile; import org.infinispan.commons.marshall.AdvancedExternalizer; import com.google.protobuf.Message; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/VAAdvancedExternalizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/VAAdvancedExternalizer.java index 5f54f74b4..f072628c4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/VAAdvancedExternalizer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/infinispan/VAAdvancedExternalizer.java @@ -23,7 +23,6 @@ import java.io.ObjectOutput; import java.util.Set; import org.apache.drill.exec.cache.CachedVectorContainer; -import org.apache.drill.exec.cache.VectorAccessibleSerializable; import org.apache.drill.exec.memory.BufferAllocator; import org.infinispan.commons.marshall.AdvancedExternalizer; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java index 2d39b5e60..510d63714 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.client; import static com.google.common.base.Preconditions.checkState; import static org.apache.drill.exec.proto.UserProtos.QueryResultsMode.STREAM_FULL; import static org.apache.drill.exec.proto.UserProtos.RunQuery.newBuilder; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; import java.io.Closeable; @@ -48,9 +47,9 @@ import org.apache.drill.exec.proto.helper.QueryIdHelper; import org.apache.drill.exec.rpc.BasicClientWithConnection.ServerConnection; import org.apache.drill.exec.rpc.ChannelClosedException; import org.apache.drill.exec.rpc.DrillRpcFuture; -import org.apache.drill.exec.rpc.TransportCheck; import org.apache.drill.exec.rpc.RpcConnectionHandler; import org.apache.drill.exec.rpc.RpcException; +import org.apache.drill.exec.rpc.TransportCheck; import org.apache.drill.exec.rpc.user.ConnectionThrottle; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.rpc.user.UserClient; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DumpCat.java b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DumpCat.java index 2d65e9121..54a5a3ab5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/client/DumpCat.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/client/DumpCat.java @@ -137,6 +137,7 @@ public class DumpCat { this.dataSize += info2.dataSize; } + @Override public String toString() { String avgRecSizeStr = null; if (this.rows>0) diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ByteCodeLoader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ByteCodeLoader.java index 648869958..704a199aa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ByteCodeLoader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ByteCodeLoader.java @@ -37,6 +37,7 @@ class ByteCodeLoader { .expireAfterWrite(10, TimeUnit.MINUTES).build(new ClassBytesCacheLoader()); private class ClassBytesCacheLoader extends CacheLoader<String, byte[]> { + @Override public byte[] load(String path) throws ClassTransformationException, IOException { URL u = this.getClass().getResource(path); if (u == null) diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassBodyBuilder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassBodyBuilder.java index 544020fad..34f622e8b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassBodyBuilder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassBodyBuilder.java @@ -58,14 +58,14 @@ public class ClassBodyBuilder { private String[] imports = {}; private String body; private boolean used = false; - + public static ClassBodyBuilder newBuilder(){ return new ClassBodyBuilder(); } - + private ClassBodyBuilder(){ } - + public ClassBodyBuilder setClassName(String className) { assertNotCooked(); this.className = className; @@ -93,7 +93,7 @@ public class ClassBodyBuilder { private void assertNotCooked() { assert !used; } - + public ClassBodyBuilder setImports(String[] imports) { assertNotCooked(); this.imports = imports; @@ -190,7 +190,7 @@ public class ClassBodyBuilder { // * <p> // * This method does not handle comments and string literals correctly, i.e. if a pattern that looks like an IMPORT // * declaration appears within a comment or a string literal, it will be taken as an IMPORT declaration. -// * +// * // * @param r // * A {@link Reader} that supports MARK, e.g. a {@link BufferedReader} // * @return The parsed imports, e.g. {@code "java.util.*", "static java.util.Map.Entry" } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java index e1f52cafa..f056489d7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JDKClassCompiler.java @@ -81,6 +81,7 @@ class JDKClassCompiler extends AbstractClassCompiler { } } + @Override protected org.slf4j.Logger getLogger() { return logger; } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java index aa16b8301..84bf4b069 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java @@ -41,6 +41,7 @@ public class JaninoClassCompiler extends AbstractClassCompiler { this.compilationClassLoader = new ClassLoaderIClassLoader(parentClassLoader); } + @Override protected byte[][] getByteCode(final ClassNames className, final String sourcecode) throws CompileException, IOException, ClassNotFoundException, ClassTransformationException { StringReader reader = new StringReader(sourcecode); @@ -56,6 +57,7 @@ public class JaninoClassCompiler extends AbstractClassCompiler { return byteCodes; } + @Override protected org.slf4j.Logger getLogger() { return logger; } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java index bd68b430a..945c94a22 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java @@ -26,7 +26,6 @@ import java.util.Iterator; import java.util.Set; import org.apache.drill.exec.compile.ClassTransformer.ClassSet; -import org.apache.drill.exec.compile.bytecode.ValueHolderReplacementVisitor; import org.apache.drill.exec.compile.sig.SignatureHolder; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassReader; @@ -89,12 +88,14 @@ class MergeAdapter extends ClassVisitor { } } + @Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { System.out.println("Annotation"); return super.visitAnnotation(desc, visible); } // visit the class + @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { // use the access and names of the impl class. this.name = name; @@ -136,6 +137,7 @@ class MergeAdapter extends ClassVisitor { return mv; } + @Override @SuppressWarnings("unchecked") public void visitEnd() { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java index 2dcb52b55..398d109ca 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/QueryClassLoader.java @@ -17,7 +17,13 @@ */ package org.apache.drill.exec.compile; -import com.google.common.collect.MapMaker; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Arrays; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicLong; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.ExpressionParsingException; import org.apache.drill.exec.compile.ClassTransformer.ClassNames; @@ -30,12 +36,7 @@ import org.apache.drill.exec.server.options.TypeValidators.LongValidator; import org.apache.drill.exec.server.options.TypeValidators.StringValidator; import org.codehaus.commons.compiler.CompileException; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Arrays; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicLong; +import com.google.common.collect.MapMaker; public class QueryClassLoader extends URLClassLoader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryClassLoader.class); @@ -59,7 +60,7 @@ public class QueryClassLoader extends URLClassLoader { public static final String JAVA_COMPILER_JANINO_MAXSIZE_OPTION = "exec.java_compiler_janino_maxsize"; public static final OptionValidator JAVA_COMPILER_JANINO_MAXSIZE = new LongValidator(JAVA_COMPILER_JANINO_MAXSIZE_OPTION, 256*1024); - + public static final String JAVA_COMPILER_CONFIG = "drill.exec.compile.compiler"; public static final String JAVA_COMPILER_DEBUG_CONFIG = "drill.exec.compile.debug"; public static final String JAVA_COMPILER_JANINO_MAXSIZE_CONFIG = "drill.exec.compile.janino_maxsize"; @@ -67,7 +68,7 @@ public class QueryClassLoader extends URLClassLoader { private ClassCompilerSelector compilerSelector; private AtomicLong index = new AtomicLong(0); - + private ConcurrentMap<String, byte[]> customClasses = new MapMaker().concurrencyLevel(4).makeMap(); public QueryClassLoader(DrillConfig config, OptionManager sessionOptions) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java index 8e0560259..7b24174d6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java @@ -50,6 +50,7 @@ public class ReplacingBasicValue extends BasicValue{ return index; } + @Override public Type getType(){ return type; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ValueHolderIden.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ValueHolderIden.java index 5099fbd71..1e10eeb6e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ValueHolderIden.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ValueHolderIden.java @@ -21,10 +21,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.List; -import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; -import org.objectweb.asm.commons.LocalVariablesSorter; import com.carrotsearch.hppc.ObjectIntOpenHashMap; import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/CodeGeneratorArgument.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/CodeGeneratorArgument.java index eacecfb97..ce9f6c942 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/CodeGeneratorArgument.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/CodeGeneratorArgument.java @@ -19,10 +19,10 @@ package org.apache.drill.exec.compile.sig; public class CodeGeneratorArgument { - + private final String name; private final Class<?> type; - + public CodeGeneratorArgument(String name, Class<?> type) { super(); this.name = name; @@ -36,5 +36,5 @@ public class CodeGeneratorArgument { public Class<?> getType() { return type; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/ConstantExpressionIdentifier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/ConstantExpressionIdentifier.java index c65951de5..d98c06b97 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/ConstantExpressionIdentifier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/ConstantExpressionIdentifier.java @@ -34,18 +34,18 @@ import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.expression.TypedNullConstant; import org.apache.drill.common.expression.ValueExpressions; import org.apache.drill.common.expression.ValueExpressions.BooleanExpression; -import org.apache.drill.common.expression.ValueExpressions.DoubleExpression; -import org.apache.drill.common.expression.ValueExpressions.LongExpression; import org.apache.drill.common.expression.ValueExpressions.DateExpression; -import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression; -import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression; -import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression; -import org.apache.drill.common.expression.ValueExpressions.TimeExpression; -import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal18Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal28Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal38Expression; +import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression; +import org.apache.drill.common.expression.ValueExpressions.DoubleExpression; +import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression; +import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression; +import org.apache.drill.common.expression.ValueExpressions.LongExpression; import org.apache.drill.common.expression.ValueExpressions.QuotedString; +import org.apache.drill.common.expression.ValueExpressions.TimeExpression; +import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression; import org.apache.drill.common.expression.visitors.ExprVisitor; import com.google.common.collect.Lists; @@ -54,7 +54,7 @@ public class ConstantExpressionIdentifier implements ExprVisitor<Boolean, Identi static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ConstantExpressionIdentifier.class); private ConstantExpressionIdentifier(){} - + /** * Get a list of expressions that mark boundaries into a constant space. * @param e @@ -63,7 +63,7 @@ public class ConstantExpressionIdentifier implements ExprVisitor<Boolean, Identi public static Set<LogicalExpression> getConstantExpressionSet(LogicalExpression e){ IdentityHashMap<LogicalExpression, Object> map = new IdentityHashMap<>(); ConstantExpressionIdentifier visitor = new ConstantExpressionIdentifier(); - + if(e.accept(visitor, map) && map.isEmpty()){ // if we receive a constant value here but the map is empty, this means the entire tree is a constant. @@ -74,7 +74,7 @@ public class ConstantExpressionIdentifier implements ExprVisitor<Boolean, Identi // so we don't continue to carry around a map, we let it go here and simply return an empty set. return Collections.emptySet(); }else{ - return map.keySet(); + return map.keySet(); } } @@ -89,7 +89,7 @@ public class ConstantExpressionIdentifier implements ExprVisitor<Boolean, Identi constant = false; } } - + // if one or more clauses isn't constant, this isn't constant. this also isn't a constant if it operates on a set. if(!constant || !transmitsConstant){ for(LogicalExpression c: constants){ @@ -98,7 +98,7 @@ public class ConstantExpressionIdentifier implements ExprVisitor<Boolean, Identi } return constant && transmitsConstant; } - + @Override public Boolean visitFunctionCall(FunctionCall call, IdentityHashMap<LogicalExpression, Object> value){ throw new UnsupportedOperationException("FunctionCall is not expected here. "+ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVReadBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVReadBatch.java index 9eb5d53f9..93616c2f3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVReadBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVReadBatch.java @@ -22,9 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.drill.common.types.TypeProtos.DataMode; -import org.apache.drill.common.types.TypeProtos.MinorType; - /** * Marker annotation to determine which fields should be included as parameters for the function. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVWriteBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVWriteBatch.java index bd362a301..dff92d00a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVWriteBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/sig/VVWriteBatch.java @@ -22,9 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.drill.common.types.TypeProtos.DataMode; -import org.apache.drill.common.types.TypeProtos.MinorType; - /** * Marker annotation to determine which fields should be included as parameters for the function. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/ClusterCoordinator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/ClusterCoordinator.java index f85510718..508a5b2c5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/ClusterCoordinator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/ClusterCoordinator.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.coord; import java.io.Closeable; import java.util.Collection; -import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; /** diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/DrillbitEndpointSerDe.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/DrillbitEndpointSerDe.java index 3f5c930f1..3961b4b7f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/DrillbitEndpointSerDe.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/DrillbitEndpointSerDe.java @@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; public class DrillbitEndpointSerDe { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillbitEndpointSerDe.class); - + public static class De extends StdDeserializer<DrillbitEndpoint> { public De() { @@ -44,11 +44,11 @@ public class DrillbitEndpointSerDe { JsonProcessingException { return DrillbitEndpoint.parseFrom(jp.getBinaryValue()); } - - + + } - - + + public static class Se extends StdSerializer<DrillbitEndpoint> { public Se() { @@ -60,6 +60,6 @@ public class DrillbitEndpointSerDe { JsonGenerationException { jgen.writeBinary(value.toByteArray()); } - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java index 3773833be..76ad90b5f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKClusterCoordinator.java @@ -105,6 +105,7 @@ public class ZKClusterCoordinator extends ClusterCoordinator { return curator; } + @Override public void start(long millisToWait) throws Exception { logger.debug("Starting ZKClusterCoordination."); discovery.start(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKRegistrationHandle.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKRegistrationHandle.java index 9cbc03b34..f0c465f97 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKRegistrationHandle.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZKRegistrationHandle.java @@ -17,17 +17,16 @@ */ package org.apache.drill.exec.coord.zk; -import org.apache.drill.exec.coord.ClusterCoordinator; import org.apache.drill.exec.coord.ClusterCoordinator.RegistrationHandle; public class ZKRegistrationHandle implements RegistrationHandle { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ZKRegistrationHandle.class); - + public final String id; public ZKRegistrationHandle(String id) { super(); this.id = id; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZkDistributedSemaphore.java b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZkDistributedSemaphore.java index 5f951d016..5e638016f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZkDistributedSemaphore.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZkDistributedSemaphore.java @@ -23,7 +23,6 @@ import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2; import org.apache.curator.framework.recipes.locks.Lease; import org.apache.drill.exec.coord.DistributedSemaphore; -import org.apache.drill.exec.coord.DistributedSemaphore.DistributedLease; public class ZkDistributedSemaphore implements DistributedSemaphore{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ZkDistributedSemaphore.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/disk/Spool.java b/exec/java-exec/src/main/java/org/apache/drill/exec/disk/Spool.java index b8d4d44a4..75886646c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/disk/Spool.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/disk/Spool.java @@ -23,7 +23,7 @@ import org.apache.drill.exec.record.RecordBatch; public interface Spool { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Spool.class); - + public void write(RecordBatch batch) throws IOException; public void read(RecordBatch batch) throws IOException; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/View.java b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/View.java index 8119c299e..a1132d743 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/View.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/View.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.dotdrill; import java.util.List; -import com.google.common.collect.ImmutableList; import org.apache.drill.exec.planner.StarColumnHelper; import org.apache.drill.exec.planner.types.RelDataTypeDrillImpl; import org.apache.drill.exec.planner.types.RelDataTypeHolder; @@ -34,6 +33,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @JsonTypeName("view") diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/BitComException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/BitComException.java index 24fb311f9..6b36bc305 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/BitComException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/BitComException.java @@ -41,5 +41,5 @@ public class BitComException extends DrillException{ public BitComException(Throwable cause) { super(cause); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/ClassTransformationException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/ClassTransformationException.java index bb5654a27..8bf91c48c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/ClassTransformationException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/ClassTransformationException.java @@ -42,6 +42,6 @@ public class ClassTransformationException extends DrillException{ public ClassTransformationException(Throwable cause) { super(cause); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/DrillbitStartupException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/DrillbitStartupException.java index a9ea9426c..03257cefb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/DrillbitStartupException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/DrillbitStartupException.java @@ -41,6 +41,6 @@ public class DrillbitStartupException extends DrillException{ public DrillbitStartupException(Throwable cause) { super(cause); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SchemaChangeException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SchemaChangeException.java index e7403a0e3..64c469e8b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SchemaChangeException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SchemaChangeException.java @@ -41,7 +41,7 @@ public class SchemaChangeException extends DrillException{ public SchemaChangeException(Throwable cause) { super(cause); } - + public SchemaChangeException(String message, Object...objects){ super(String.format(message, objects)); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SetupException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SetupException.java index e22aac064..e877e7592 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SetupException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/exception/SetupException.java @@ -41,6 +41,6 @@ public class SetupException extends DrillException{ public SetupException(Throwable cause) { super(cause); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DirectExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DirectExpression.java index a13176365..bbf00c72c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DirectExpression.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DirectExpression.java @@ -22,18 +22,18 @@ import com.sun.codemodel.JFormatter; public class DirectExpression extends JExpressionImpl{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DirectExpression.class); - + final String source; - + private DirectExpression(final String source) { super(); this.source = source; } - + public void generate( JFormatter f ) { f.p('(').p(source).p(')'); } - + public static DirectExpression direct( final String source ) { return new DirectExpression(source); } @@ -62,6 +62,6 @@ public class DirectExpression extends JExpressionImpl{ return false; return true; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java index 785a8a6e6..d1734d443 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java @@ -66,24 +66,24 @@ public class DrillFuncHolderExpr extends FunctionHolderExpression implements Ite public boolean argConstantOnly(int i) { return holder.isConstant(i); } - + public boolean isComplexWriterFuncHolder() { return holder instanceof DrillComplexWriterFuncHolder; } - + @Override - public int getSelfCost() { + public int getSelfCost() { return holder.getCostCategory(); } - + @Override - public int getCumulativeCost() { + public int getCumulativeCost() { int cost = this.getSelfCost(); - + for (LogicalExpression arg : this.args) { cost += arg.getCumulativeCost(); } - + return cost; } @@ -91,6 +91,6 @@ public class DrillFuncHolderExpr extends FunctionHolderExpression implements Ite public DrillFuncHolderExpr copy(List<LogicalExpression> args) { return new DrillFuncHolderExpr(this.nameUsed, this.holder, args, this.getPosition()); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java index de71eec0c..1e671583b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java @@ -29,9 +29,9 @@ import org.apache.drill.common.expression.FunctionHolderExpression; import org.apache.drill.common.expression.IfExpression; import org.apache.drill.common.expression.IfExpression.IfCondition; import org.apache.drill.common.expression.LogicalExpression; +import org.apache.drill.common.expression.NullExpression; import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.expression.SchemaPath; -import org.apache.drill.common.expression.NullExpression; import org.apache.drill.common.expression.TypedNullConstant; import org.apache.drill.common.expression.ValueExpressions.BooleanExpression; import org.apache.drill.common.expression.ValueExpressions.DateExpression; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java index d3c2f8e25..7b4c3d66a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java @@ -17,17 +17,9 @@ */ package org.apache.drill.exec.expr; -import java.lang.reflect.Array; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; - import org.apache.drill.common.expression.BooleanOperator; import org.apache.drill.common.expression.CastExpression; import org.apache.drill.common.expression.ConvertExpression; @@ -36,27 +28,26 @@ import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.common.expression.FunctionHolderExpression; import org.apache.drill.common.expression.IfExpression; -import org.apache.drill.common.expression.IfExpression.IfCondition; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.NullExpression; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.expression.TypedNullConstant; import org.apache.drill.common.expression.ValueExpressions; import org.apache.drill.common.expression.ValueExpressions.BooleanExpression; -import org.apache.drill.common.expression.ValueExpressions.DoubleExpression; -import org.apache.drill.common.expression.ValueExpressions.FloatExpression; -import org.apache.drill.common.expression.ValueExpressions.LongExpression; import org.apache.drill.common.expression.ValueExpressions.DateExpression; -import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression; -import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression; -import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression; -import org.apache.drill.common.expression.ValueExpressions.TimeExpression; -import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal18Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal28Expression; import org.apache.drill.common.expression.ValueExpressions.Decimal38Expression; +import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression; +import org.apache.drill.common.expression.ValueExpressions.DoubleExpression; +import org.apache.drill.common.expression.ValueExpressions.FloatExpression; import org.apache.drill.common.expression.ValueExpressions.IntExpression; +import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression; +import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression; +import org.apache.drill.common.expression.ValueExpressions.LongExpression; import org.apache.drill.common.expression.ValueExpressions.QuotedString; +import org.apache.drill.common.expression.ValueExpressions.TimeExpression; +import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression; import org.apache.drill.common.expression.fn.CastFunctions; import org.apache.drill.common.expression.visitors.AbstractExprVisitor; import org.apache.drill.common.expression.visitors.ConditionalExprOptimizer; @@ -73,12 +64,15 @@ import org.apache.drill.exec.expr.fn.DrillFuncHolder; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorAccessible; -import org.apache.drill.exec.resolver.DefaultFunctionResolver; import org.apache.drill.exec.resolver.FunctionResolver; import org.apache.drill.exec.resolver.FunctionResolverFactory; +import org.apache.drill.exec.resolver.TypeCastRules; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import org.apache.drill.exec.resolver.TypeCastRules; public class ExpressionTreeMaterializer { @@ -91,14 +85,14 @@ public class ExpressionTreeMaterializer { return ExpressionTreeMaterializer.materialize(expr, batch, errorCollector, registry, false); } - public static LogicalExpression materialize(LogicalExpression expr, VectorAccessible batch, ErrorCollector errorCollector, FunctionImplementationRegistry registry, + public static LogicalExpression materialize(LogicalExpression expr, VectorAccessible batch, ErrorCollector errorCollector, FunctionImplementationRegistry registry, boolean allowComplexWriterExpr) { LogicalExpression out = expr.accept(new MaterializeVisitor(batch, errorCollector, allowComplexWriterExpr), registry); - + if (!errorCollector.hasErrors()) { out = out.accept(ConditionalExprOptimizer.INSTANCE, null); } - + if(out instanceof NullExpression){ return new TypedNullConstant(Types.optional(MinorType.INT)); }else{ @@ -110,7 +104,7 @@ public class ExpressionTreeMaterializer { private ExpressionValidator validator = new ExpressionValidator(); private final ErrorCollector errorCollector; private final VectorAccessible batch; - private final boolean allowComplexWriter; + private final boolean allowComplexWriter; public MaterializeVisitor(VectorAccessible batch, ErrorCollector errorCollector, boolean allowComplexWriter) { this.batch = batch; @@ -145,7 +139,7 @@ public class ExpressionTreeMaterializer { } //replace with a new function call, since its argument could be changed. - return new BooleanOperator(op.getName(), args, op.getPosition()); + return new BooleanOperator(op.getName(), args, op.getPosition()); } private LogicalExpression addCastExpression(LogicalExpression fromExpr, MajorType toType, FunctionImplementationRegistry registry) { @@ -197,7 +191,7 @@ public class ExpressionTreeMaterializer { if (matchedFuncHolder instanceof DrillComplexWriterFuncHolder && ! allowComplexWriter) { errorCollector.addGeneralError(call.getPosition(), "Only ProjectRecordBatch could have complex writer function. You are using complex writer function " + call.getName() + " in a non-project operation!"); } - + //new arg lists, possible with implicit cast inserted. List<LogicalExpression> argsWithCast = Lists.newArrayList(); @@ -502,7 +496,7 @@ public class ExpressionTreeMaterializer { // if the type still isn't fully bound, leave as cast expression. return new CastExpression(input, e.getMajorType(), e.getPosition()); } else if (newMinor == MinorType.NULL) { - // if input is a NULL expression, remove cast expression and return a TypedNullConstant directly. + // if input is a NULL expression, remove cast expression and return a TypedNullConstant directly. return new TypedNullConstant(Types.optional(e.getMajorType().getMinorType())); } else { // if the type is fully bound, convert to functioncall and materialze the function. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java index 45051b976..3e6ad4a3d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HoldingContainerExpression.java @@ -25,14 +25,13 @@ import org.apache.drill.common.expression.visitors.ExprVisitor; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Iterators; public class HoldingContainerExpression implements LogicalExpression{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HoldingContainerExpression.class); final HoldingContainer container; - + public HoldingContainerExpression(HoldingContainer container) { this.container = container; } @@ -52,7 +51,7 @@ public class HoldingContainerExpression implements LogicalExpression{ return visitor.visitUnknown(this, value); } - + public HoldingContainer getContainer() { return container; } @@ -61,15 +60,15 @@ public class HoldingContainerExpression implements LogicalExpression{ public ExpressionPosition getPosition() { return ExpressionPosition.UNKNOWN; } - + @Override - public int getSelfCost() { - return 0; // TODO + public int getSelfCost() { + return 0; // TODO } - + @Override - public int getCumulativeCost() { + public int getCumulativeCost() { return 0; // TODO } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/SingleClassStringWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/SingleClassStringWriter.java index f292b5e19..a284db1cb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/SingleClassStringWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/SingleClassStringWriter.java @@ -31,13 +31,13 @@ public class SingleClassStringWriter extends CodeWriter{ private boolean used; private StringWriter writer = new StringWriter(); - + @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { throw new UnsupportedOperationException(); } - + @Override public Writer openSource(JPackage pkg, String fileName) throws IOException { Preconditions.checkArgument(!used, "The SingleClassStringWriter can only output once src file."); @@ -52,6 +52,6 @@ public class SingleClassStringWriter extends CodeWriter{ public StringBuffer getCode(){ return writer.getBuffer(); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java index f8236d9a8..a5abf3e74 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java @@ -23,9 +23,7 @@ import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.expression.visitors.ExprVisitor; -import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; -import org.apache.drill.common.types.Types; import org.apache.drill.exec.record.TypedFieldId; import com.google.common.collect.Iterators; @@ -78,15 +76,15 @@ public class ValueVectorReadExpression implements LogicalExpression{ public Iterator<LogicalExpression> iterator() { return Iterators.emptyIterator(); } - + @Override - public int getSelfCost() { - return 0; // TODO + public int getSelfCost() { + return 0; // TODO } - + @Override - public int getCumulativeCost() { + public int getCumulativeCost() { return 0; // TODO } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorWriteExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorWriteExpression.java index d2770578b..1fb46e43c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorWriteExpression.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorWriteExpression.java @@ -34,17 +34,17 @@ public class ValueVectorWriteExpression implements LogicalExpression { private final TypedFieldId fieldId; private final LogicalExpression child; private final boolean safe; - + public ValueVectorWriteExpression(TypedFieldId fieldId, LogicalExpression child){ this(fieldId, child, false); } - + public ValueVectorWriteExpression(TypedFieldId fieldId, LogicalExpression child, boolean safe){ this.fieldId = fieldId; this.child = child; this.safe = safe; } - + public TypedFieldId getFieldId() { return fieldId; } @@ -54,7 +54,7 @@ public class ValueVectorWriteExpression implements LogicalExpression { return Types.NULL; } - + public boolean isSafe() { return safe; } @@ -72,21 +72,21 @@ public class ValueVectorWriteExpression implements LogicalExpression { public LogicalExpression getChild() { return child; } - + @Override public Iterator<LogicalExpression> iterator() { return Iterators.singletonIterator(child); } @Override - public int getSelfCost() { - return 0; // TODO + public int getSelfCost() { + return 0; // TODO } - + @Override - public int getCumulativeCost() { + public int getCumulativeCost() { return 0; // TODO } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java index bd4b7f18b..1f732a398 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/FunctionTemplate.java @@ -45,13 +45,13 @@ public @interface FunctionTemplate { NullHandling nulls() default NullHandling.INTERNAL; boolean isBinaryCommutative() default false; boolean isRandom() default false; - + FunctionCostCategory costCategory() default FunctionCostCategory.SIMPLE; - + public static enum NullHandling { INTERNAL, NULL_IF_NULL; } - + public static enum FunctionScope{ SIMPLE, POINT_AGGREGATE, @@ -69,23 +69,23 @@ public @interface FunctionTemplate { DECIMAL_ZERO_SCALE, SC_BOOLEAN_OPERATOR } - + public static enum FunctionCostCategory { SIMPLE(1), MEDIUM(3), COMPLEX(5); - + private final int value; - + private FunctionCostCategory(int value) { this.value = value; } - + public int getValue() { return this.value; } - + public static FunctionCostCategory getDefault() { return SIMPLE; } - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/MethodMap.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/MethodMap.java index cc54c2e24..775f6a385 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/MethodMap.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/MethodMap.java @@ -22,17 +22,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.drill.common.types.TypeProtos.DataMode; -import org.apache.drill.common.types.TypeProtos.MinorType; - /** * Marker annotation to determine which fields should be included as parameters for the function. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) public @interface MethodMap { - - + + String parentMethod(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/Param.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/Param.java index 8bdc2dddd..a93121152 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/Param.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/annotations/Param.java @@ -22,9 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.apache.drill.common.types.TypeProtos.DataMode; -import org.apache.drill.common.types.TypeProtos.MinorType; - /** * Marker annotation to determine which fields should be included as parameters for the function. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/AbstractFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/AbstractFuncHolder.java index f79450c5b..48420abd5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/AbstractFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/AbstractFuncHolder.java @@ -17,7 +17,8 @@ */ package org.apache.drill.exec.expr.fn; -import com.sun.codemodel.JVar; +import java.util.List; + import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FunctionHolderExpression; import org.apache.drill.common.expression.LogicalExpression; @@ -26,7 +27,7 @@ import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.expr.ClassGenerator; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; -import java.util.List; +import com.sun.codemodel.JVar; public abstract class AbstractFuncHolder implements FuncHolder { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java index c60d4c9a9..6e0b282d4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillAggFuncHolder.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.expr.fn; import java.util.List; import java.util.Map; -import com.sun.codemodel.JType; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.Types; @@ -41,6 +40,7 @@ import com.sun.codemodel.JExpression; import com.sun.codemodel.JForLoop; import com.sun.codemodel.JInvocation; import com.sun.codemodel.JMod; +import com.sun.codemodel.JType; import com.sun.codemodel.JVar; class DrillAggFuncHolder extends DrillFuncHolder{ @@ -74,10 +74,12 @@ class DrillAggFuncHolder extends DrillFuncHolder{ Preconditions.checkNotNull(reset); } + @Override public boolean isNested(){ return true; } + @Override public boolean isAggregating() { return true; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java index 0efee6332..df561749b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java @@ -22,15 +22,12 @@ import java.util.List; import java.util.Map; import org.apache.drill.common.expression.FieldReference; -import org.apache.drill.common.types.TypeProtos.DataMode; -import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.expr.ClassGenerator; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.physical.impl.project.ProjectRecordBatch; import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl; -import org.apache.drill.exec.vector.complex.reader.FieldReader; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; import com.sun.codemodel.JBlock; @@ -39,11 +36,10 @@ import com.sun.codemodel.JConditional; import com.sun.codemodel.JExpr; import com.sun.codemodel.JExpression; import com.sun.codemodel.JInvocation; -import com.sun.codemodel.JMod; import com.sun.codemodel.JVar; public class DrillComplexWriterFuncHolder extends DrillSimpleFuncHolder{ - + private FieldReference ref; public DrillComplexWriterFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, @@ -55,7 +51,7 @@ public class DrillComplexWriterFuncHolder extends DrillSimpleFuncHolder{ public void setReference(FieldReference ref) { this.ref = ref; } - + @Override protected HoldingContainer generateEvalBody(ClassGenerator<?> g, HoldingContainer[] inputVariables, String body, JVar[] workspaceJVars) { @@ -67,41 +63,41 @@ public class DrillComplexWriterFuncHolder extends DrillSimpleFuncHolder{ JVar complexWriter = g.declareClassField("complexWriter", g.getModel()._ref(ComplexWriter.class)); JClass cwClass = g.getModel().ref(ComplexWriterImpl.class); - + JInvocation container = g.getMappingSet().getOutgoing().invoke("getOutgoingContainer"); - - //Default name is "col", if not passed in a reference name for the output vector. + + //Default name is "col", if not passed in a reference name for the output vector. String refName = ref == null? "col" : ref.getRootSegment().getPath(); - + g.getSetupBlock().assign(complexWriter, cwClass.staticInvoke("getWriter").arg(refName).arg(container)); - + JClass projBatchClass = g.getModel().ref(ProjectRecordBatch.class); JExpression projBatch = JExpr.cast(projBatchClass, g.getMappingSet().getOutgoing()); - + g.getSetupBlock().add(projBatch.invoke("addComplexWriter").arg(complexWriter)); - - + + g.getEvalBlock().add(complexWriter.invoke("setPosition").arg(g.getMappingSet().getValueWriteIndex())); - + sub.decl(g.getModel()._ref(ComplexWriter.class), returnValue.name, complexWriter); - + // add the subblock after the out declaration. g.getEvalBlock().add(topSub); addProtectedBlock(g, sub, body, inputVariables, workspaceJVars, false); - - + + JConditional jc = g.getEvalBlock()._if(complexWriter.invoke("ok").not()); - - jc._then().add(complexWriter.invoke("reset")); + + jc._then().add(complexWriter.invoke("reset")); //jc._then().directStatement("System.out.println(\"debug : write ok fail!, inIndex = \" + inIndex);"); jc._then()._return(JExpr.FALSE); - - //jc._else().directStatement("System.out.println(\"debug : write successful, inIndex = \" + inIndex);"); - + + //jc._else().directStatement("System.out.println(\"debug : write successful, inIndex = \" + inIndex);"); + g.getEvalBlock().directStatement(String.format("//---- end of eval portion of %s function. ----//", registeredNames[0])); return null; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java index 61e04cad1..3871cd751 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAddFuncHolder.java @@ -24,7 +24,6 @@ import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.util.DecimalScalePrecisionAddFunction; -import org.apache.drill.common.util.DecimalScalePrecisionDivideFunction; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.util.DecimalUtility; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java index a5de0cd0c..51d21aa0d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalAggFuncHolder.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.expr.fn; +import java.util.List; +import java.util.Map; + import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.exec.expr.annotations.FunctionTemplate; -import java.util.List; -import java.util.Map; - public class DrillDecimalAggFuncHolder extends DrillAggFuncHolder { public DrillDecimalAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) { super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java index 2a0ac0cac..db49173b9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalCastFuncHolder.java @@ -25,7 +25,6 @@ import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.ValueExpressions; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; - import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java index c3a23e745..683a04fd0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalDivScaleFuncHolder.java @@ -69,7 +69,7 @@ public class DrillDecimalDivScaleFuncHolder extends DrillSimpleFuncHolder{ return (TypeProtos.MajorType.newBuilder().setMinorType(DecimalUtility.getDecimalDataType(outputScalePrec.getOutputPrecision())) .setScale(outputScalePrec.getOutputScale()).setPrecision(outputScalePrec.getOutputPrecision()).setMode(mode).build()); } - + @Override public boolean checkPrecisionRange() { return true; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java index 62fa51366..7e54586a4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalMaxScaleFuncHolder.java @@ -23,7 +23,6 @@ import java.util.Map; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; - import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java index 621e1ddac..b5e754e06 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalModScaleFuncHolder.java @@ -23,7 +23,6 @@ import java.util.Map; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; -import org.apache.drill.common.util.DecimalScalePrecisionDivideFunction; import org.apache.drill.common.util.DecimalScalePrecisionModFunction; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java index b7df04f97..47b8507a5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSetScaleFuncHolder.java @@ -24,7 +24,6 @@ import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.ValueExpressions; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; - import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java index 69ab0677b..2988be557 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalSumAggFuncHolder.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.expr.fn; +import java.util.List; +import java.util.Map; + import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.exec.expr.annotations.FunctionTemplate; -import java.util.List; -import java.util.Map; - public class DrillDecimalSumAggFuncHolder extends DrillAggFuncHolder { public DrillDecimalSumAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) { super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java index 2ee60bf4d..674fc87c2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillDecimalZeroScaleFuncHolder.java @@ -23,7 +23,6 @@ import java.util.Map; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; - import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFunctionRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFunctionRegistry.java index 2e7a10408..f53bd2842 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFunctionRegistry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFunctionRegistry.java @@ -22,18 +22,18 @@ import java.util.List; import java.util.Map.Entry; import java.util.Set; -import com.google.common.collect.Sets; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.util.PathScanner; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.expr.DrillFunc; - -import com.google.common.collect.ArrayListMultimap; import org.apache.drill.exec.planner.sql.DrillOperatorTable; import org.apache.drill.exec.planner.sql.DrillSqlAggOperator; import org.apache.drill.exec.planner.sql.DrillSqlOperator; import org.eigenbase.sql.SqlOperator; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Sets; + public class DrillFunctionRegistry { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillFunctionRegistry.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java index 53df02ded..397cf9214 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillSimpleFuncHolder.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.expr.fn; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -52,7 +51,7 @@ class DrillSimpleFuncHolder extends DrillFuncHolder{ Map<String, String> methods, List<String> imports) { this(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, FunctionCostCategory.getDefault()); } - + public DrillSimpleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports, FunctionCostCategory costCategory) { @@ -65,10 +64,12 @@ class DrillSimpleFuncHolder extends DrillFuncHolder{ } + @Override public boolean isNested(){ return false; } + @Override public HoldingContainer renderEnd(ClassGenerator<?> g, HoldingContainer[] inputVariables, JVar[] workspaceJVars){ //If the function's annotation specifies a parameter has to be constant expression, but the HoldingContainer //for the argument is not, then raise exception. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionBody.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionBody.java index 7999d4130..df110edd9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionBody.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionBody.java @@ -19,11 +19,11 @@ package org.apache.drill.exec.expr.fn; public class FunctionBody { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FunctionBody.class); - - + + public static enum BodyType{ - SETUP, EVAL_INNER, EVAL_OUTER, + SETUP, EVAL_INNER, EVAL_OUTER, } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java index 4a63aaca9..293fbf7b6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionGenerationHelper.java @@ -23,17 +23,12 @@ import java.util.List; import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FunctionHolderExpression; import org.apache.drill.common.expression.LogicalExpression; -import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; -import org.apache.drill.exec.expr.DrillFunc; -import org.apache.drill.exec.expr.DrillFuncHolderExpr; import org.apache.drill.exec.expr.HoldingContainerExpression; -import com.google.common.collect.ImmutableList; - public class FunctionGenerationHelper { public static final String COMPARE_TO = "compare_to"; @@ -49,9 +44,9 @@ public class FunctionGenerationHelper { FunctionImplementationRegistry registry) { return getFunctionExpression(COMPARE_TO, Types.required(MinorType.INT), registry, left, right); } - + public static FunctionHolderExpression getFunctionExpression(String name, MajorType returnType, FunctionImplementationRegistry registry, HoldingContainer... args){ - + List<MajorType> argTypes = new ArrayList<MajorType>(args.length); List<LogicalExpression> argExpressions = new ArrayList<LogicalExpression>(args.length); for(HoldingContainer c : args){ @@ -77,7 +72,7 @@ public class FunctionGenerationHelper { appendType(returnType, sb); throw new UnsupportedOperationException(sb.toString()); } - + private static final void appendType(MajorType mt, StringBuilder sb){ sb.append(mt.getMinorType().name()); sb.append(":"); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java index 46a24b41e..055fdfabd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java @@ -17,7 +17,11 @@ */ package org.apache.drill.exec.expr.fn; -import com.google.common.collect.Lists; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.List; +import java.util.Set; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.common.types.TypeProtos.MajorType; @@ -26,10 +30,7 @@ import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.planner.sql.DrillOperatorTable; import org.apache.drill.exec.resolver.FunctionResolver; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Set; +import com.google.common.collect.Lists; public class FunctionImplementationRegistry { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FunctionImplementationRegistry.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java index af62d2ba7..d87e6faca 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java @@ -31,13 +31,13 @@ import com.google.common.collect.Lists; public class ImportGrabber{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ImportGrabber.class); - + private List<String> imports = Lists.newArrayList(); private final ImportFinder finder = new ImportFinder(); private ImportGrabber() { } - + public class ImportFinder extends Traverser{ @Override @@ -60,9 +60,9 @@ public class ImportGrabber{ imports.add(siodd.toString()); } - + } - + public static List<String> getMethods(Java.CompilationUnit cu){ ImportGrabber visitor = new ImportGrabber(); cu.getPackageMemberTypeDeclarations()[0].accept(visitor.finder.comprehensiveVisitor()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java index 3a87f43ba..91718bcdf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java @@ -23,7 +23,6 @@ import java.util.Map; import org.codehaus.janino.Java; import org.codehaus.janino.Java.ClassDeclaration; import org.codehaus.janino.Java.MethodDeclarator; -import org.codehaus.janino.UnparseVisitor; import org.codehaus.janino.util.Traverser; import com.google.common.collect.Maps; @@ -31,17 +30,17 @@ import com.google.common.collect.Maps; public class MethodGrabbingVisitor{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MethodGrabbingVisitor.class); - + private Class<?> c; private Map<String, String> methods = Maps.newHashMap(); private ClassFinder classFinder = new ClassFinder(); private boolean captureMethods = false; - + private MethodGrabbingVisitor(Class<?> c) { super(); this.c = c; } - + public class ClassFinder extends Traverser{ @Override @@ -56,21 +55,21 @@ public class MethodGrabbingVisitor{ @Override public void traverseMethodDeclarator(MethodDeclarator md) { // logger.debug(c.getName() + ": Found {}, include {}", md.name, captureMethods); - + if(captureMethods){ StringWriter writer = new StringWriter(); ModifiedUnparseVisitor v = new ModifiedUnparseVisitor(writer); // UnparseVisitor v = new UnparseVisitor(writer); - + md.accept(v); v.close(); writer.flush(); - methods.put(md.name, writer.getBuffer().toString()); + methods.put(md.name, writer.getBuffer().toString()); } - } + } } - + public static Map<String, String> getMethods(Java.CompilationUnit cu, Class<?> c){ MethodGrabbingVisitor visitor = new MethodGrabbingVisitor(c); cu.getPackageMemberTypeDeclarations()[0].accept(visitor.classFinder.comprehensiveVisitor()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ModifiedUnparseVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ModifiedUnparseVisitor.java index 4b79bba02..aea46e8e9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ModifiedUnparseVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ModifiedUnparseVisitor.java @@ -53,6 +53,7 @@ public class ModifiedUnparseVisitor extends UnparseVisitor { super(w); } + @Override public void visitMethodDeclarator(Java.MethodDeclarator md) { if (md.optionalStatements == null) { this.pw.print(';'); @@ -73,6 +74,7 @@ public class ModifiedUnparseVisitor extends UnparseVisitor { } } + @Override public void visitReturnStatement(Java.ReturnStatement rs) { this.pw.print("break " + returnLabel); if (rs.optionalReturnValue != null) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Alternator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Alternator.java index 641063be4..93504291a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Alternator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/Alternator.java @@ -17,25 +17,21 @@ */ package org.apache.drill.exec.expr.fn.impl; -import org.apache.drill.exec.expr.DrillAggFunc; import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.Output; -import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BigIntHolder; -import org.apache.drill.exec.expr.holders.IntHolder; -import org.apache.drill.exec.expr.holders.VarCharHolder; import org.apache.drill.exec.record.RecordBatch; public class Alternator { - + @FunctionTemplate(name = "alternate", isRandom = true, scope = FunctionScope.SIMPLE) public static class Alternate2 implements DrillSimpleFunc{ @Workspace int val; @Output BigIntHolder out; - + public void setup(RecordBatch incoming) { val = 0; } @@ -55,7 +51,7 @@ public class Alternator { public static class Alternate3 implements DrillSimpleFunc{ @Workspace int val; @Output BigIntHolder out; - + public void setup(RecordBatch incoming) { val = 0; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java index 3ffc68291..7b2432250 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java @@ -28,7 +28,7 @@ import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.record.RecordBatch; public class BitFunctions { - + @FunctionTemplate(names = {"booleanOr", "or", "||"}, scope = FunctionScope.SC_BOOLEAN_OPERATOR, nulls = NullHandling.NULL_IF_NULL) public static class BitOr implements DrillSimpleFunc { @@ -41,7 +41,7 @@ public class BitFunctions { public void eval() { out.value = left.value | right.value; } - } + } @FunctionTemplate(names = {"booleanAnd", "and", "&&"}, scope = FunctionScope.SC_BOOLEAN_OPERATOR, nulls = NullHandling.NULL_IF_NULL) public static class BitAnd implements DrillSimpleFunc { @@ -55,9 +55,9 @@ public class BitFunctions { public void eval() { out.value = left.value & right.value; } - } - - + } + + @FunctionTemplate(names = {"xor", "^"}, scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) public static class IntXor implements DrillSimpleFunc { @@ -70,7 +70,7 @@ public class BitFunctions { public void eval() { out.value = left.value ^ right.value; } - } - + } + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BooleanAggrFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BooleanAggrFunctions.java index b13a58b1a..d555fadc2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BooleanAggrFunctions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BooleanAggrFunctions.java @@ -26,29 +26,11 @@ package org.apache.drill.exec.expr.fn.impl; import org.apache.drill.exec.expr.DrillAggFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; -import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; -import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.NullableBitHolder; -import org.apache.drill.exec.expr.holders.BigIntHolder; -import org.apache.drill.exec.expr.holders.NullableBigIntHolder; -import org.apache.drill.exec.expr.holders.IntHolder; -import org.apache.drill.exec.expr.holders.NullableIntHolder; -import org.apache.drill.exec.expr.holders.SmallIntHolder; -import org.apache.drill.exec.expr.holders.NullableSmallIntHolder; -import org.apache.drill.exec.expr.holders.TinyIntHolder; -import org.apache.drill.exec.expr.holders.NullableTinyIntHolder; -import org.apache.drill.exec.expr.holders.UInt1Holder; -import org.apache.drill.exec.expr.holders.NullableUInt1Holder; -import org.apache.drill.exec.expr.holders.UInt2Holder; -import org.apache.drill.exec.expr.holders.NullableUInt2Holder; -import org.apache.drill.exec.expr.holders.UInt4Holder; -import org.apache.drill.exec.expr.holders.NullableUInt4Holder; -import org.apache.drill.exec.expr.holders.UInt8Holder; -import org.apache.drill.exec.expr.holders.NullableUInt8Holder; import org.apache.drill.exec.record.RecordBatch; @SuppressWarnings("unused") diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java index cbb87bbae..8c55aa91b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java @@ -18,11 +18,12 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl; -import com.google.common.primitives.UnsignedLongs; - import io.netty.util.internal.PlatformDependent; + import org.apache.drill.exec.util.DecimalUtility; +import com.google.common.primitives.UnsignedLongs; + public class ByteFunctionHelpers { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ByteFunctionHelpers.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteSubstring.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteSubstring.java index d55de788e..ad2efa22c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteSubstring.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteSubstring.java @@ -71,7 +71,7 @@ public class ByteSubstring implements DrillSimpleFunc { out.start = string.end + (int)offset.value; else out.start = (int)offset.value - 1; - + // calculate end position from length and truncate to upper value bounds if (out.start + length.value > string.end) out.end = string.end; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java index 4d355076f..014a4d469 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java @@ -26,7 +26,6 @@ import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BigIntHolder; import org.apache.drill.exec.expr.holders.TimeStampTZHolder; import org.apache.drill.exec.record.RecordBatch; -import org.joda.time.DateTime; @SuppressWarnings("unused") @FunctionTemplate(names = {"castTIMESTAMPTZ", "to_timestamptz"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls= NullHandling.NULL_IF_NULL) diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CharSubstring.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CharSubstring.java index 9b18f5864..5fdc6f2f1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CharSubstring.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CharSubstring.java @@ -38,11 +38,11 @@ import org.apache.drill.exec.record.RecordBatch; * value's length will be used. * * - If the substring is invalid, return an empty string. - * + * * - NOTE: UTF-8 values range from 1 to 4 bytes per character, thus searching for the * start, length, and negative length may result in 3 partial scans of the * UTF-8 string. - * + * * - TODO: implement optional length parameter */ @FunctionTemplate(names = {"charsubstring", "substring2", "substr2"}, @@ -103,7 +103,7 @@ public class CharSubstring implements DrillSimpleFunc { int endCharPos = --charCount; while (byteCount >= 0) { currentByte = string.buffer.getByte(byteCount); - + if (endCharPos - charCount == -(int)offset.value) { // matched the negative start offset out.start = byteCount; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctions.java index 15034cd19..bf42ce6c0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ComparisonFunctions.java @@ -17,18 +17,6 @@ */ package org.apache.drill.exec.expr.fn.impl; -import org.apache.drill.exec.expr.DrillSimpleFunc; -import org.apache.drill.exec.expr.annotations.FunctionTemplate; -import org.apache.drill.exec.expr.annotations.Output; -import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.holders.BigIntHolder; -import org.apache.drill.exec.expr.holders.BitHolder; -import org.apache.drill.exec.expr.holders.Float4Holder; -import org.apache.drill.exec.expr.holders.Float8Holder; -import org.apache.drill.exec.expr.holders.IntHolder; -import org.apache.drill.exec.expr.holders.VarBinaryHolder; -import org.apache.drill.exec.expr.holders.VarCharHolder; -import org.apache.drill.exec.record.RecordBatch; public class ComparisonFunctions { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MathFunctions.class); @@ -370,7 +358,7 @@ public class ComparisonFunctions { // out.value = (left.value <= right.value) ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "equal", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryEqual implements DrillSimpleFunc { // @@ -384,7 +372,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 0 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "equal", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarCharEqual implements DrillSimpleFunc { // @@ -398,7 +386,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 0 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "equal", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryCharEqual implements DrillSimpleFunc { // @@ -412,7 +400,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 0 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryGTE implements DrillSimpleFunc { // @@ -426,7 +414,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) > -1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarCharGTE implements DrillSimpleFunc { // @@ -440,7 +428,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) > -1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryCharGTE implements DrillSimpleFunc { // @@ -454,7 +442,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) > -1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryGT implements DrillSimpleFunc { // @@ -468,7 +456,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarCharGT implements DrillSimpleFunc { // @@ -482,7 +470,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "greater than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryCharGT implements DrillSimpleFunc { // @@ -496,7 +484,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == 1? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryLTE implements DrillSimpleFunc { // @@ -510,7 +498,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) < 1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarCharLTE implements DrillSimpleFunc { // @@ -524,7 +512,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) < 1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than or equal to", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryCharLTE implements DrillSimpleFunc { // @@ -538,7 +526,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) < 1? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryLT implements DrillSimpleFunc { // @@ -552,7 +540,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == -1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarCharLT implements DrillSimpleFunc { // @@ -566,7 +554,7 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == -1 ? 1 : 0; // } // } -// +// // @FunctionTemplate(name = "less than", scope = FunctionTemplate.FunctionScope.SIMPLE) // public static class VarBinaryCharLT implements DrillSimpleFunc { // @@ -580,5 +568,5 @@ public class ComparisonFunctions { // out.value = org.apache.drill.exec.expr.fn.impl.VarHelpers.compare(left, right) == -1 ? 1 : 0; // } // } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java index 5a3a214cb..a031bee11 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java @@ -18,8 +18,6 @@ package org.apache.drill.exec.expr.fn.impl; -import java.util.HashMap; - import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillByteArray.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillByteArray.java index d1c67ef5d..5fd7e5217 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillByteArray.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DrillByteArray.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.expr.fn.impl; /** * Thin wrapper around byte array. This class is used by aggregate functions which - * consume decimal, variable width vectors as inputs. + * consume decimal, variable width vectors as inputs. */ public class DrillByteArray { private byte[] bytes; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java index c089c0006..0e9509afd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashHelper.java @@ -22,8 +22,8 @@ import java.nio.ByteOrder; public class HashHelper { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashHelper.class); - - + + /** taken from mahout **/ public static int hash(ByteBuffer buf, int seed) { // save byte order for later restoration diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java index cc1eab968..39288b4a1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/MathFunctions.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.expr.fn.impl; +import java.text.DecimalFormat; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; @@ -25,50 +27,44 @@ import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BigIntHolder; -import org.apache.drill.exec.expr.holders.Float4Holder; import org.apache.drill.exec.expr.holders.Float8Holder; -import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; import org.apache.drill.exec.record.RecordBatch; -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.text.ParseException; - public class MathFunctions{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MathFunctions.class); - + private MathFunctions(){} - + @FunctionTemplate(names = {"negative", "u-", "-"}, scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) public static class Negative implements DrillSimpleFunc{ - + @Param BigIntHolder input; @Output BigIntHolder out; public void setup(RecordBatch b){} - + public void eval(){ out.value = -input.value; return; } - } + } @FunctionTemplate(name = "power", scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) public static class Power implements DrillSimpleFunc{ - + @Param Float8Holder a; @Param Float8Holder b; @Output Float8Holder out; public void setup(RecordBatch b){} - + public void eval(){ out.value = java.lang.Math.pow(a.value, b.value); } - } + } @FunctionTemplate(name = "random", isRandom = true, scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) @@ -76,7 +72,7 @@ public class MathFunctions{ @Output Float8Holder out; public void setup(RecordBatch b){} - + public void eval(){ out.value = java.lang.Math.random(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/RegexpUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/RegexpUtil.java index 0b48d0e39..38c831695 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/RegexpUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/RegexpUtil.java @@ -18,7 +18,7 @@ package org.apache.drill.exec.expr.fn.impl; /** - * Code copied from optiq (https://github.com/julianhyde/optiq). + * Code copied from optiq (https://github.com/julianhyde/optiq). * Thanks goes to Julian Hyde and other contributors of optiq. */ @@ -48,12 +48,12 @@ public class RegexpUtil { }; /** - * Translates a SQL LIKE pattern to Java regex pattern. No escape char. + * Translates a SQL LIKE pattern to Java regex pattern. No escape char. */ public static String sqlToRegexLike(String sqlPattern) { return sqlToRegexLike(sqlPattern, (char)0); } - + /** * Translates a SQL LIKE pattern to Java regex pattern, with optional * escape string. @@ -216,12 +216,12 @@ public class RegexpUtil { } /** - * Translates a SQL SIMILAR pattern to Java regex pattern. No escape char. - */ + * Translates a SQL SIMILAR pattern to Java regex pattern. No escape char. + */ public static String sqlToRegexSimilar(String sqlPattern) { return sqlToRegexSimilar(sqlPattern, (char) 0); } - + /** * Translates a SQL SIMILAR pattern to Java regex pattern, with optional * escape string. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionUtil.java index 68253096c..3b7efbdf3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionUtil.java @@ -17,10 +17,10 @@ */ package org.apache.drill.exec.expr.fn.impl; -import org.apache.drill.common.exceptions.DrillRuntimeException; - import io.netty.buffer.ByteBuf; +import org.apache.drill.common.exceptions.DrillRuntimeException; + public class StringFunctionUtil { /* Decode the input bytebuf using UTF-8, and return the number of characters diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java index 7f6c8d2b4..57dd2d5e1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BigIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java index 7a6f302c0..c647d3a35 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BigIntVLongConvertTo.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BigIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java index c2a63b529..43db659f5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/BooleanByteConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java index 4affa5527..12136f3a6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochBEConvertTo.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.DateHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java index adaba9f81..bddb62172 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DateEpochConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.DateHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java index dd0c7f8a2..29f625e83 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DoubleConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertFrom.java index ac75f48d5..50e0cbb24 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertFrom.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertFrom.java @@ -28,7 +28,7 @@ import org.apache.drill.exec.record.RecordBatch; /** * This and {@link DummyConvertTo} class merely act as a placeholder so that Optiq - * allows 'convert_to()' and 'convert_from()' functions in SQL. + * allows 'convert_to()' and 'convert_from()' functions in SQL. */ @FunctionTemplate(name = "convert_from", scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) public class DummyConvertFrom implements DrillSimpleFunc { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertTo.java index 36ddf6dfc..c2ac3efec 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/DummyConvertTo.java @@ -28,7 +28,7 @@ import org.apache.drill.exec.record.RecordBatch; /** * This and {@link DummyConvertFrom} class merely act as a placeholder so that Optiq - * allows 'convert_to()' and 'convert_from()' functions in SQL. + * allows 'convert_to()' and 'convert_from()' functions in SQL. */ @FunctionTemplate(name = "convert_to", scope = FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL) public class DummyConvertTo implements DrillSimpleFunc { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java index 9175901c0..3cce965ad 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/FloatConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.Float4Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java index 45687f5d2..02ee8e22f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntBEConvertTo.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java index 0ef7700f2..4dd1ef497 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java index be0924576..715c72d0e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/IntVIntConvertTo.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java index 62d526bd9..46b539033 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java @@ -19,30 +19,21 @@ package org.apache.drill.exec.expr.fn.impl.conv; -import java.io.ByteArrayOutputStream; -import java.io.StringReader; +import io.netty.buffer.DrillBuf; import javax.inject.Inject; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.DrillBuf; - import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; -import org.apache.drill.exec.expr.annotations.Output; -import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; +import org.apache.drill.exec.expr.annotations.Output; +import org.apache.drill.exec.expr.annotations.Param; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.vector.complex.fn.JsonWriter; -import org.apache.drill.exec.vector.complex.reader.FieldReader; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; -import com.google.common.base.Charsets; - public class JsonConvertFrom { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JsonConvertFrom.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java index 68c9f3306..b1620e61c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntBEConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.SmallIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java index 2d9703369..2cdaafbb1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/SmallIntConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.SmallIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java index 06cd0852e..bbd75a612 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochBEConvertTo.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.TimeHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java index d3802e8ba..c9baad331 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TimeEpochConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.TimeHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java index f4d582e7c..3abde4f4a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/TinyIntConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.TinyIntHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java index 4e6d606a7..904151f02 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/UInt8ConvertTo.java @@ -18,18 +18,16 @@ ******************************************************************************/ package org.apache.drill.exec.expr.fn.impl.conv; -import javax.inject.Inject; - -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import javax.inject.Inject; + import org.apache.drill.exec.expr.DrillSimpleFunc; import org.apache.drill.exec.expr.annotations.FunctionTemplate; import org.apache.drill.exec.expr.annotations.FunctionTemplate.FunctionScope; import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling; import org.apache.drill.exec.expr.annotations.Output; import org.apache.drill.exec.expr.annotations.Param; -import org.apache.drill.exec.expr.annotations.Workspace; import org.apache.drill.exec.expr.holders.UInt8Holder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java index 7cf445cef..4df964615 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/Accountor.java @@ -17,8 +17,8 @@ */ package org.apache.drill.exec.memory; -import io.netty.buffer.DrillBuf; import io.netty.buffer.ByteBuf; +import io.netty.buffer.DrillBuf; import java.util.Arrays; import java.util.Collection; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AtomicRemainder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AtomicRemainder.java index 0d549747b..83cd3b748 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AtomicRemainder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/AtomicRemainder.java @@ -17,9 +17,6 @@ */ package org.apache.drill.exec.memory; -import org.apache.drill.common.exceptions.DrillRuntimeException; -import org.apache.drill.common.exceptions.ExecutionSetupException; - import java.util.concurrent.atomic.AtomicLong; /** diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java index 67a041df1..8971eea89 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/BufferAllocator.java @@ -17,8 +17,8 @@ */ package org.apache.drill.exec.memory; -import io.netty.buffer.DrillBuf; import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.DrillBuf; import java.io.Closeable; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/OutOfMemoryException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/OutOfMemoryException.java index 3e89ca535..063f1c1d7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/OutOfMemoryException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/OutOfMemoryException.java @@ -24,28 +24,28 @@ public class OutOfMemoryException extends FragmentSetupException{ public OutOfMemoryException() { super(); - + } public OutOfMemoryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); - + } public OutOfMemoryException(String message, Throwable cause) { super(message, cause); - + } public OutOfMemoryException(String message) { super(message); - + } public OutOfMemoryException(Throwable cause) { super(cause); - + } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java index ae80f7b45..5a594aaa3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/memory/TopLevelAllocator.java @@ -17,10 +17,8 @@ */ package org.apache.drill.exec.memory; -import io.netty.buffer.DrillBuf; -import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.PooledByteBufAllocator; +import io.netty.buffer.DrillBuf; import io.netty.buffer.PooledByteBufAllocatorL; import io.netty.buffer.UnsafeDirectLittleEndian; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java index 6bdce3b0f..e54a967dc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java @@ -26,6 +26,7 @@ import java.util.Map; import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.jdbc.SimpleOptiqSchema; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.compile.ClassTransformer; @@ -48,10 +49,6 @@ import org.apache.drill.exec.server.options.OptionList; import org.apache.drill.exec.server.options.OptionManager; import org.apache.drill.exec.work.batch.IncomingBuffers; -import java.io.Closeable; -import java.io.IOException; -import java.util.List; -import java.util.Map; import com.carrotsearch.hppc.LongObjectOpenHashMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/OperatorStats.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/OperatorStats.java index 285c6c29b..8771ab836 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/OperatorStats.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/OperatorStats.java @@ -174,7 +174,7 @@ public class OperatorStats { public void addDoubleStat(MetricDef metric, double value){ doubleMetrics.putOrAdd(metric.metricId(), value, value); } - + public void setLongStat(MetricDef metric, long value){ longMetrics.put(metric.metricId(), value); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java index 50d753fb2..1ad144d09 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java @@ -17,8 +17,11 @@ */ package org.apache.drill.exec.ops; +import java.util.Collection; + import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.jdbc.SimpleOptiqSchema; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.cache.DistributedCache; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; @@ -36,8 +39,6 @@ import org.apache.drill.exec.server.options.QueryOptionManager; import org.apache.drill.exec.store.StoragePluginRegistry; import org.apache.drill.exec.store.sys.PStoreProvider; -import java.util.Collection; - public class QueryContext{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryContext.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java index 1f473c511..b993d77d2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/opt/BasicOptimizer.java @@ -17,7 +17,12 @@ */ package org.apache.drill.exec.opt; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + import org.apache.drill.common.JSONOptions; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.ExecutionSetupException; @@ -55,11 +60,7 @@ import org.apache.drill.exec.store.StoragePlugin; import org.eigenbase.rel.RelFieldCollation.Direction; import org.eigenbase.rel.RelFieldCollation.NullDirection; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import com.google.common.collect.Lists; public class BasicOptimizer extends Optimizer{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BasicOptimizer.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/PhysicalPlan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/PhysicalPlan.java index 4082661f3..78b882b79 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/PhysicalPlan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/PhysicalPlan.java @@ -20,10 +20,9 @@ package org.apache.drill.exec.physical; import java.io.IOException; import java.util.List; -import org.apache.drill.common.logical.PlanProperties; -import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.graph.Graph; import org.apache.drill.common.graph.GraphAlgos; +import org.apache.drill.common.logical.PlanProperties; import org.apache.drill.exec.physical.base.Leaf; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.Root; @@ -39,23 +38,23 @@ import com.google.common.collect.Lists; @JsonPropertyOrder({ "head", "graph" }) public class PhysicalPlan { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PhysicalPlan.class); - + PlanProperties properties; - + Graph<PhysicalOperator, Root, Leaf> graph; - + @JsonCreator public PhysicalPlan(@JsonProperty("head") PlanProperties properties, @JsonProperty("graph") List<PhysicalOperator> operators){ this.properties = properties; this.graph = Graph.newGraph(operators, Root.class, Leaf.class); } - + @JsonProperty("graph") public List<PhysicalOperator> getSortedOperators(){ // reverse the list so that nested references are flattened rather than nested. return getSortedOperators(true); } - + public List<PhysicalOperator> getSortedOperators(boolean reverse){ List<PhysicalOperator> list = GraphAlgos.TopoSorter.sort(graph); if(reverse){ @@ -63,7 +62,7 @@ public class PhysicalPlan { }else{ return list; } - + } @@ -90,5 +89,5 @@ public class PhysicalPlan { throw new RuntimeException(e); } } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractBase.java index 54f9ef836..e54e67c3d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractBase.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.physical.base; import org.apache.drill.common.graph.GraphVisitor; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; -import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; public abstract class AbstractBase implements PhysicalOperator{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java index 7326be6f9..909a15232 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractMultiple.java @@ -17,10 +17,10 @@ */ package org.apache.drill.exec.physical.base; -import com.google.common.collect.Iterators; - import java.util.Iterator; +import com.google.common.collect.Iterators; + /** * Describes an operator that expects more than one children operators as its input. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java index 5e854251b..9e7beec47 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java @@ -30,7 +30,6 @@ import org.apache.drill.exec.physical.config.MergingReceiverPOP; import org.apache.drill.exec.physical.config.OrderedPartitionSender; import org.apache.drill.exec.physical.config.ProducerConsumer; import org.apache.drill.exec.physical.config.Project; -import org.apache.drill.exec.physical.config.UnorderedReceiver; import org.apache.drill.exec.physical.config.RangeSender; import org.apache.drill.exec.physical.config.Screen; import org.apache.drill.exec.physical.config.SingleSender; @@ -39,6 +38,7 @@ import org.apache.drill.exec.physical.config.StreamingAggregate; import org.apache.drill.exec.physical.config.Trace; import org.apache.drill.exec.physical.config.UnionAll; import org.apache.drill.exec.physical.config.UnionExchange; +import org.apache.drill.exec.physical.config.UnorderedReceiver; public abstract class AbstractPhysicalVisitor<T, X, E extends Throwable> implements PhysicalVisitor<T, X, E> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractPhysicalVisitor.class); @@ -90,9 +90,9 @@ public abstract class AbstractPhysicalVisitor<T, X, E extends Throwable> impleme @Override public T visitHashAggregate(HashAggregate agg, X value) throws E { - return visitOp(agg, value); + return visitOp(agg, value); } - + @Override public T visitSender(Sender sender, X value) throws E { return visitOp(sender, value); @@ -118,14 +118,14 @@ public abstract class AbstractPhysicalVisitor<T, X, E extends Throwable> impleme return visitOp(store, value); } - + public T visitChildren(PhysicalOperator op, X value) throws E{ for(PhysicalOperator child : op){ child.accept(this, value); } return null; } - + @Override public T visitMergeJoin(MergeJoinPOP join, X value) throws E { return visitOp(join, value); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSingle.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSingle.java index 6c0b98f86..2b10e6d0a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSingle.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractSingle.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.physical.base; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.base.Preconditions; import com.google.common.collect.Iterators; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/FragmentRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/FragmentRoot.java index f4a358c7c..1721fcf62 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/FragmentRoot.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/FragmentRoot.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.physical.base; /** - * Describes the root operation within a particular Fragment. This includes things Sender nodes. + * Describes the root operation within a particular Fragment. This includes things Sender nodes. */ public interface FragmentRoot extends FragmentLeaf{ } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/GroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/GroupScan.java index 9c27c0c37..a88a5ec83 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/GroupScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/GroupScan.java @@ -19,13 +19,13 @@ package org.apache.drill.exec.physical.base; import java.util.List; -import com.google.common.collect.Lists; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.exceptions.PhysicalOperatorSetupException; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.collect.Lists; /** * A GroupScan operator represents all data which will be scanned by a given physical diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/HasAffinity.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/HasAffinity.java index faf082968..52462db77 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/HasAffinity.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/HasAffinity.java @@ -27,7 +27,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; * Describes a physical operator that has affinity to particular nodes. Used for assignment decisions. */ public interface HasAffinity extends PhysicalOperator { - + /** * Get the list of Endpoints with associated affinities that this operator has preference for. * @return List of EndpointAffinity objects. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java index a5dbd6a6b..dfcb11393 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalOperatorUtil.java @@ -23,9 +23,9 @@ import org.apache.drill.common.util.PathScanner; public class PhysicalOperatorUtil { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PhysicalOperatorUtil.class); - + private PhysicalOperatorUtil(){} - + public synchronized static Class<?>[] getSubTypes(DrillConfig config){ Class<?>[] ops = PathScanner.scanForImplementationsArr(PhysicalOperator.class, config.getStringList(CommonConstants.PHYSICAL_OPERATOR_SCAN_PACKAGES)); logger.debug("Adding Physical Operator sub types: {}", ((Object) ops) ); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java index f0b0b9a84..8da06cbb8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java @@ -30,7 +30,6 @@ import org.apache.drill.exec.physical.config.MergingReceiverPOP; import org.apache.drill.exec.physical.config.OrderedPartitionSender; import org.apache.drill.exec.physical.config.ProducerConsumer; import org.apache.drill.exec.physical.config.Project; -import org.apache.drill.exec.physical.config.UnorderedReceiver; import org.apache.drill.exec.physical.config.RangeSender; import org.apache.drill.exec.physical.config.Screen; import org.apache.drill.exec.physical.config.SingleSender; @@ -39,6 +38,7 @@ import org.apache.drill.exec.physical.config.StreamingAggregate; import org.apache.drill.exec.physical.config.Trace; import org.apache.drill.exec.physical.config.UnionAll; import org.apache.drill.exec.physical.config.UnionExchange; +import org.apache.drill.exec.physical.config.UnorderedReceiver; /** * Visitor class designed to traversal of a operator tree. Basis for a number of operator manipulations including fragmentation and materialization. @@ -48,8 +48,8 @@ import org.apache.drill.exec.physical.config.UnionExchange; */ public interface PhysicalVisitor<RETURN, EXTRA, EXCEP extends Throwable> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PhysicalVisitor.class); - - + + public RETURN visitExchange(Exchange exchange, EXTRA value) throws EXCEP; public RETURN visitGroupScan(GroupScan groupScan, EXTRA value) throws EXCEP; public RETURN visitSubScan(SubScan subScan, EXTRA value) throws EXCEP; @@ -69,7 +69,7 @@ public interface PhysicalVisitor<RETURN, EXTRA, EXCEP extends Throwable> { public RETURN visitHashAggregate(HashAggregate agg, EXTRA value) throws EXCEP; public RETURN visitWriter(Writer op, EXTRA value) throws EXCEP; public RETURN visitOp(PhysicalOperator op, EXTRA value) throws EXCEP; - + public RETURN visitHashPartitionSender(HashPartitionSender op, EXTRA value) throws EXCEP; public RETURN visitOrderedPartitionSender(OrderedPartitionSender op, EXTRA value) throws EXCEP; public RETURN visitUnorderedReceiver(UnorderedReceiver op, EXTRA value) throws EXCEP; @@ -81,6 +81,6 @@ public interface PhysicalVisitor<RETURN, EXTRA, EXCEP extends Throwable> { public RETURN visitSingleSender(SingleSender op, EXTRA value) throws EXCEP; public RETURN visitUnionExchange(UnionExchange op, EXTRA value) throws EXCEP; public RETURN visitProducerConsumer(ProducerConsumer op, EXTRA value) throws EXCEP; - + public RETURN visitIteratorValidator(IteratorValidator op, EXTRA value) throws EXCEP; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Receiver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Receiver.java index ef6535f01..0c67770e9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Receiver.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Receiver.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * corresponding Senders. Receivers are a special type of Physical Operator that are typically only expressed within the execution plan. */ public interface Receiver extends FragmentLeaf { - + /** * A receiver is expecting streams from one or more providing endpoints. This method should return a list of the expected sending endpoints. * @return List of counterpart sending DrillbitEndpoints. @@ -40,7 +40,7 @@ public interface Receiver extends FragmentLeaf { * Whether or not this receive supports out of order exchange. This provides a hint for the scheduling node on whether * the receiver can start work if only a subset of all sending endpoints are currently providing data. A random * receiver would supports this form of operation. A NWAY receiver would not. - * + * * @return True if this receiver supports working on a streaming/out of order input. */ @JsonIgnore diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Sender.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Sender.java index 00d94eb70..bbd1b2c8d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Sender.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Sender.java @@ -28,13 +28,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; * record set to a set of destination locations. This is typically only utilized at the level of the execution plan. */ public interface Sender extends FragmentRoot { - + /** * Get the list of destination endpoints that this Sender will be communicating with. * @return List of DrillbitEndpoints. */ public abstract List<DrillbitEndpoint> getDestinations(); - + /** * Get the receiver major fragment id that is opposite this sender. * @return diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Store.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Store.java index beefb9bae..acf53f2be 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Store.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/Store.java @@ -35,7 +35,7 @@ public interface Store extends HasAffinity { * Inform the Store node about the actual decided DrillbitEndpoint assignments desired for storage purposes. This is a * precursor to the execution planner running a set of getSpecificStore() method calls for full Store node * materialization. - * + * * @param endpoints * The list of endpoints that this Store node are going to be executed on. * @throws PhysicalOperatorSetupException @@ -44,7 +44,7 @@ public interface Store extends HasAffinity { /** * Provides full materialized Store operators for execution purposes. - * + * * @param child * The child operator that this operator will consume from. * @param minorFragmentId @@ -60,7 +60,7 @@ public interface Store extends HasAffinity { * parallelizations that it can support. For example, a Screen return cannot be parallelized at all. In this case, a * maxWidth value of 1 will be returned. In the case that there is no limit for parallelization, this method should * return Integer.MAX_VALUE. - * + * * @return */ @JsonIgnore diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ExternalSort.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ExternalSort.java index c196a962c..456b9c0cc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ExternalSort.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ExternalSort.java @@ -39,10 +39,12 @@ public class ExternalSort extends Sort { super(child, orderings, reverse); } + @Override public List<Ordering> getOrderings() { return orderings; } + @Override public boolean getReverse() { return reverse; } @@ -68,6 +70,7 @@ public class ExternalSort extends Sort { this.maxAllocation = Math.max(initialAllocation, maxAllocation); } + @Override public long getInitialAllocation() { return initialAllocation; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToMergeExchange.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToMergeExchange.java index 8bae26f78..f62d9224f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToMergeExchange.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToMergeExchange.java @@ -35,16 +35,16 @@ import com.fasterxml.jackson.annotation.JsonTypeName; public class HashToMergeExchange extends AbstractExchange{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashToMergeExchange.class); - + private final LogicalExpression distExpr; private final List<Ordering> orderExprs; //ephemeral for setup tasks. private List<DrillbitEndpoint> senderLocations; private List<DrillbitEndpoint> receiverLocations; - + @JsonCreator - public HashToMergeExchange(@JsonProperty("child") PhysicalOperator child, + public HashToMergeExchange(@JsonProperty("child") PhysicalOperator child, @JsonProperty("expr") LogicalExpression expr, @JsonProperty("orderings") List<Ordering> orderExprs) { super(child); @@ -88,6 +88,6 @@ public class HashToMergeExchange extends AbstractExchange{ return orderExprs; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToRandomExchange.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToRandomExchange.java index dddaf8382..fac374bcd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToRandomExchange.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashToRandomExchange.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.physical.config; -import java.beans.Transient; import java.util.List; import org.apache.drill.common.expression.LogicalExpression; @@ -35,13 +34,13 @@ import com.fasterxml.jackson.annotation.JsonTypeName; public class HashToRandomExchange extends AbstractExchange{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashToRandomExchange.class); - + private final LogicalExpression expr; //ephemeral for setup tasks. private List<DrillbitEndpoint> senderLocations; private List<DrillbitEndpoint> receiverLocations; - + @JsonCreator public HashToRandomExchange(@JsonProperty("child") PhysicalOperator child, @JsonProperty("expr") LogicalExpression expr) { super(child); @@ -84,6 +83,6 @@ public class HashToRandomExchange extends AbstractExchange{ return expr; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/MergingReceiverPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/MergingReceiverPOP.java index d76ec8058..f5dca1abf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/MergingReceiverPOP.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/MergingReceiverPOP.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.physical.config; import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.drill.common.logical.data.Order.Ordering; import org.apache.drill.exec.physical.base.AbstractReceiver; import org.apache.drill.exec.physical.base.PhysicalVisitor; @@ -27,6 +26,7 @@ import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/PartitionRange.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/PartitionRange.java index 00bb32869..25e184341 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/PartitionRange.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/PartitionRange.java @@ -24,10 +24,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class PartitionRange { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PartitionRange.class); - + private LogicalExpression start; private LogicalExpression finish; - + @JsonCreator public PartitionRange(@JsonProperty("start") LogicalExpression start, @JsonProperty("finish") LogicalExpression finish) { super(); @@ -42,6 +42,6 @@ public class PartitionRange { public LogicalExpression getFinish() { return finish; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ProducerConsumer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ProducerConsumer.java index 87655d149..3159ef852 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ProducerConsumer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/ProducerConsumer.java @@ -17,14 +17,15 @@ */ package org.apache.drill.exec.physical.config; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeName; import org.apache.drill.exec.physical.base.AbstractSingle; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.PhysicalVisitor; import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; + @JsonTypeName("producer-consumer") public class ProducerConsumer extends AbstractSingle{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProducerConsumer.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/TopN.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/TopN.java index 4e3d9cd0b..4d2f1f051 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/TopN.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/TopN.java @@ -40,10 +40,12 @@ public class TopN extends Sort { this.limit = limit; } + @Override public List<Ordering> getOrderings() { return orderings; } + @Override public boolean getReverse() { return reverse; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnorderedReceiver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnorderedReceiver.java index 357d62d60..3a4dd0ed6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnorderedReceiver.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/UnorderedReceiver.java @@ -19,13 +19,13 @@ package org.apache.drill.exec.physical.config; import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.drill.exec.physical.base.AbstractReceiver; import org.apache.drill.exec.physical.base.PhysicalVisitor; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/BatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/BatchCreator.java index b55abefc4..8dc0a6b11 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/BatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/BatchCreator.java @@ -20,13 +20,12 @@ package org.apache.drill.exec.physical.impl; import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.record.RecordBatch; public interface BatchCreator<T extends PhysicalOperator> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BatchCreator.class); - + public RecordBatch getBatch(FragmentContext context, T config, List<RecordBatch> children) throws ExecutionSetupException; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java index 873a040b0..7f9762415 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ImplCreator.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.physical.impl; import java.util.List; import java.util.concurrent.TimeUnit; -import com.google.common.base.Stopwatch; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.AbstractPhysicalVisitor; @@ -31,6 +30,7 @@ import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.util.AssertionUtil; import com.google.common.base.Preconditions; +import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; /** @@ -79,7 +79,7 @@ public class ImplCreator extends AbstractPhysicalVisitor<RecordBatch, FragmentCo public static RootExec getExec(FragmentContext context, FragmentRoot root) throws ExecutionSetupException { ImplCreator i = new ImplCreator(); if(AssertionUtil.isAssertionsEnabled()){ - root = IteratorValidatorInjector.rewritePlanWithIteratorValidator(context, root); + root = IteratorValidatorInjector.rewritePlanWithIteratorValidator(context, root); } Stopwatch watch = new Stopwatch(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/MergingReceiverCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/MergingReceiverCreator.java index 4058a7949..528611e3b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/MergingReceiverCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/MergingReceiverCreator.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.physical.impl; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.MergingReceiverPOP; @@ -25,8 +27,6 @@ import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.work.batch.IncomingBuffers; import org.apache.drill.exec.work.batch.RawBatchBuffer; -import java.util.List; - public class MergingReceiverCreator implements BatchCreator<MergingReceiverPOP> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MergingReceiverCreator.class); @@ -44,6 +44,6 @@ public class MergingReceiverCreator implements BatchCreator<MergingReceiverPOP> return new MergingRecordBatch(context, receiver, buffers); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootCreator.java index 0bae6feb0..f3d95243c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootCreator.java @@ -26,6 +26,6 @@ import org.apache.drill.exec.record.RecordBatch; public interface RootCreator<T extends PhysicalOperator> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RootCreator.class); - + public RootExec getRoot(FragmentContext context, T config, List<RecordBatch> children) throws ExecutionSetupException; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootExec.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootExec.java index 42ac4f66d..4250e27f4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootExec.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/RootExec.java @@ -26,13 +26,13 @@ import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; */ public interface RootExec { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RootExec.class); - + /** - * Do the next batch of work. + * Do the next batch of work. * @return Whether or not additional batches of work are necessary. False means that this fragment is done. */ public boolean next(); - + /** * Inform all children to clean up and go away. */ @@ -43,5 +43,5 @@ public interface RootExec { * @param handle */ public void receivingFragmentFinished(FragmentHandle handle); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java index 79a25dcee..c2a03b9d4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java @@ -32,7 +32,6 @@ import org.apache.drill.common.types.Types; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.TypeHelper; -import org.apache.drill.exec.expr.holders.NullableVarCharHolder; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.OperatorContext; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java index d96bdf356..bd15ac9ae 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScreenCreator.java @@ -26,7 +26,6 @@ import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.MetricDef; -import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.config.Screen; import org.apache.drill.exec.physical.impl.materialize.QueryWritableBatch; import org.apache.drill.exec.physical.impl.materialize.RecordMaterializer; @@ -71,13 +70,13 @@ public class ScreenCreator implements RootCreator<Screen>{ public enum Metric implements MetricDef { BYTES_SENT; - + @Override public int metricId() { return ordinal(); } } - + public ScreenRoot(FragmentContext context, RecordBatch incoming, Screen config) throws OutOfMemoryException { super(context, config); assert context.getConnection() != null : "A screen root should only be run on the driving node which is connected directly to the client. As such, this should always be true."; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SendingAccountor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SendingAccountor.java index d67d214b4..7af7b65f1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SendingAccountor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SendingAccountor.java @@ -22,7 +22,7 @@ import java.util.concurrent.Semaphore; /** * Account for whether all messages sent have been completed. Necessary before finishing a task so we don't think * buffers are hanging when they will be released. - * + * * TODO: Need to update to use long for number of pending messages. */ public class SendingAccountor { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SingleSenderCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SingleSenderCreator.java index 26aa5abd2..2b7fdf3b6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SingleSenderCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/SingleSenderCreator.java @@ -25,8 +25,6 @@ import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.MetricDef; -import org.apache.drill.exec.ops.OperatorContext; -import org.apache.drill.exec.ops.OperatorStats; import org.apache.drill.exec.physical.config.SingleSender; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.GeneralRPCProtos.Ack; @@ -45,9 +43,9 @@ public class SingleSenderCreator implements RootCreator<SingleSender>{ assert children != null && children.size() == 1; return new SingleSenderRootExec(context, children.iterator().next(), config); } - - - + + + private static class SingleSenderRootExec extends BaseRootExec { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SingleSenderRootExec.class); private RecordBatch incoming; @@ -61,13 +59,13 @@ public class SingleSenderCreator implements RootCreator<SingleSender>{ public enum Metric implements MetricDef { BYTES_SENT; - + @Override public int metricId() { return ordinal(); } } - + public SingleSenderRootExec(FragmentContext context, RecordBatch batch, SingleSender config) throws OutOfMemoryException { super(context, config); this.incoming = batch; @@ -78,12 +76,12 @@ public class SingleSenderCreator implements RootCreator<SingleSender>{ this.tunnel = context.getDataTunnel(config.getDestination(), opposite); this.context = context; } - + @Override public boolean innerNext() { if(!ok){ incoming.kill(false); - + return false; } @@ -128,9 +126,9 @@ public class SingleSenderCreator implements RootCreator<SingleSender>{ throw new IllegalStateException(); } } - + public void updateStats(FragmentWritableBatch writableBatch) { - stats.addLongStat(Metric.BYTES_SENT, writableBatch.getByteCount()); + stats.addLongStat(Metric.BYTES_SENT, writableBatch.getByteCount()); } @Override @@ -167,10 +165,10 @@ public class SingleSenderCreator implements RootCreator<SingleSender>{ context.fail(new RpcException("A downstream fragment batch wasn't accepted. This fragment thus fails.")); stop(); } - + } - + } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java index fb9554c10..6eede30dc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java @@ -58,7 +58,6 @@ import org.apache.drill.exec.record.WritableBatch; import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; import org.eigenbase.rel.RelFieldCollation.Direction; import com.google.common.base.Stopwatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNSortBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNSortBatchCreator.java index 08c754395..aa8b6115d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNSortBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNSortBatchCreator.java @@ -17,16 +17,15 @@ */ package org.apache.drill.exec.physical.impl.TopN; -import com.google.common.base.Preconditions; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.config.Sort; import org.apache.drill.exec.physical.config.TopN; import org.apache.drill.exec.physical.impl.BatchCreator; -import org.apache.drill.exec.physical.impl.sort.SortBatch; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.base.Preconditions; public class TopNSortBatchCreator implements BatchCreator<TopN>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TopNSortBatchCreator.class); @@ -36,6 +35,6 @@ public class TopNSortBatchCreator implements BatchCreator<TopN>{ Preconditions.checkArgument(children.size() == 1); return new TopNBatch(config, context, children.iterator().next()); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TraceInjector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TraceInjector.java index dddb53f01..58dd247e0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TraceInjector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TraceInjector.java @@ -18,6 +18,8 @@ package org.apache.drill.exec.physical.impl; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.AbstractPhysicalVisitor; @@ -25,8 +27,6 @@ import org.apache.drill.exec.physical.base.FragmentRoot; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.Trace; -import java.util.List; - import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java index ef4db2a78..99eeed374 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/WriterRecordBatch.java @@ -32,7 +32,6 @@ import org.apache.drill.exec.record.AbstractRecordBatch; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordValueAccessor; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.store.EventBasedRecordWriter; import org.apache.drill.exec.store.RecordWriter; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/BatchIterator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/BatchIterator.java index feb44897f..8a9259e95 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/BatchIterator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/BatchIterator.java @@ -21,6 +21,6 @@ import org.apache.drill.exec.record.RecordBatch.IterOutcome; public interface BatchIterator { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BatchIterator.class); - + public IterOutcome next(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java index 393fa4f58..e9be2ac99 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.physical.impl.aggregate; import java.io.IOException; -import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.ErrorCollector; @@ -30,31 +29,27 @@ import org.apache.drill.exec.compile.sig.GeneratorMapping; import org.apache.drill.exec.compile.sig.MappingSet; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.SchemaChangeException; -import org.apache.drill.exec.expr.CodeGenerator; import org.apache.drill.exec.expr.ClassGenerator; import org.apache.drill.exec.expr.ClassGenerator.BlockType; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; +import org.apache.drill.exec.expr.CodeGenerator; import org.apache.drill.exec.expr.ExpressionTreeMaterializer; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.expr.ValueVectorWriteExpression; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.HashAggregate; +import org.apache.drill.exec.physical.impl.aggregate.HashAggregator.AggOutcome; +import org.apache.drill.exec.physical.impl.common.HashTable; +import org.apache.drill.exec.physical.impl.common.HashTableConfig; import org.apache.drill.exec.record.AbstractRecordBatch; -import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; -import org.apache.drill.exec.physical.impl.aggregate.HashAggregator.AggOutcome; -import org.apache.drill.exec.physical.impl.common.HashTable; -import org.apache.drill.exec.physical.impl.common.HashTableConfig; -import com.google.common.collect.Lists; import com.sun.codemodel.JExpr; import com.sun.codemodel.JVar; @@ -242,13 +237,13 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> { HashTable.DEFAULT_LOAD_FACTOR, popConfig.getGroupByExprs(), null /* no probe exprs */) ; - + agg.setup(popConfig, htConfig, context, this.stats, oContext.getAllocator(), incoming, this, aggrExprs, cgInner.getWorkspaceTypes(), - groupByOutFieldIds, - this.container); + groupByOutFieldIds, + this.container); return agg; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatchCreator.java index 5e0167e43..8c605415d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatchCreator.java @@ -23,7 +23,6 @@ import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.HashAggregate; import org.apache.drill.exec.physical.impl.BatchCreator; -import org.apache.drill.exec.physical.impl.aggregate.HashAggBatch; import org.apache.drill.exec.record.RecordBatch; import com.google.common.base.Preconditions; @@ -36,6 +35,6 @@ public class HashAggBatchCreator implements BatchCreator<HashAggregate>{ Preconditions.checkArgument(children.size() == 1); return new HashAggBatch(config, children.iterator().next(), context); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java index 22df5f600..b6b887415 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java @@ -29,10 +29,10 @@ import org.apache.drill.common.expression.ErrorCollectorImpl; import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.expression.LogicalExpression; +import org.apache.drill.exec.compile.sig.RuntimeOverridden; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.TypeHelper; -import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.MetricDef; @@ -52,7 +52,6 @@ import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.allocator.VectorAllocator; -import org.apache.drill.exec.compile.sig.RuntimeOverridden; import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggregator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggregator.java index 421bd5315..4277f2306 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggregator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggregator.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.physical.impl.aggregate; import java.io.IOException; import java.util.List; -import java.util.Collection; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.exec.compile.TemplateClassDefinition; @@ -34,7 +33,6 @@ import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorContainer; -import org.apache.drill.exec.vector.allocator.VectorAllocator; public interface HashAggregator { @@ -43,13 +41,13 @@ public interface HashAggregator { public static enum AggOutcome { RETURN_OUTCOME, CLEANUP_AND_RETURN, UPDATE_AGGREGATOR } - - public abstract void setup(HashAggregate hashAggrConfig, HashTableConfig htConfig, FragmentContext context, + + public abstract void setup(HashAggregate hashAggrConfig, HashTableConfig htConfig, FragmentContext context, OperatorStats stats, BufferAllocator allocator, RecordBatch incoming, - HashAggBatch outgoing, LogicalExpression[] valueExprs, + HashAggBatch outgoing, LogicalExpression[] valueExprs, List<TypedFieldId> valueFieldIds, TypedFieldId[] keyFieldIds, - VectorContainer outContainer) + VectorContainer outContainer) throws SchemaChangeException, IOException, ClassTransformationException; public abstract IterOutcome getOutcome(); @@ -61,9 +59,9 @@ public interface HashAggregator { public abstract void cleanup(); public abstract boolean allFlushed(); - + public abstract boolean buildComplete(); - + public abstract IterOutcome outputCurrentBatch(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java index 39131125d..820f7229b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatch.java @@ -18,12 +18,9 @@ package org.apache.drill.exec.physical.impl.aggregate; import java.io.IOException; -import java.util.List; import org.apache.drill.common.expression.ErrorCollector; import org.apache.drill.common.expression.ErrorCollectorImpl; -import org.apache.drill.common.expression.ExpressionPosition; -import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.logical.data.NamedExpression; import org.apache.drill.exec.compile.sig.GeneratorMapping; @@ -39,13 +36,11 @@ import org.apache.drill.exec.expr.HoldingContainerExpression; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.expr.ValueVectorWriteExpression; import org.apache.drill.exec.expr.fn.FunctionGenerationHelper; -import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.StreamingAggregate; import org.apache.drill.exec.physical.impl.aggregate.StreamingAggregator.AggOutcome; import org.apache.drill.exec.record.AbstractRecordBatch; -import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatch; @@ -53,10 +48,7 @@ import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import com.sun.codemodel.JExpr; import com.sun.codemodel.JVar; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatchCreator.java index 96b71fecf..0203b8144 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggBatchCreator.java @@ -35,6 +35,6 @@ public class StreamingAggBatchCreator implements BatchCreator<StreamingAggregate Preconditions.checkArgument(children.size() == 1); return new StreamingAggBatch(config, children.iterator().next(), context); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java index 6ed37e747..53ac1ed4f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggTemplate.java @@ -25,8 +25,6 @@ import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.VectorWrapper; -import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; public abstract class StreamingAggTemplate implements StreamingAggregator { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StreamingAggregator.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggregator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggregator.java index c624c9aac..8f5f29be1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggregator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/StreamingAggregator.java @@ -22,7 +22,6 @@ import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.RecordBatch.IterOutcome; -import org.apache.drill.exec.vector.allocator.VectorAllocator; public interface StreamingAggregator { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderCreator.java index add5117be..01122bebd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderCreator.java @@ -17,7 +17,8 @@ */ package org.apache.drill.exec.physical.impl.broadcastsender; -import com.google.common.collect.Iterators; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.BroadcastSender; @@ -25,7 +26,7 @@ import org.apache.drill.exec.physical.impl.RootCreator; import org.apache.drill.exec.physical.impl.RootExec; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.collect.Iterators; public class BroadcastSenderCreator implements RootCreator<BroadcastSender> { @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderRootExec.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderRootExec.java index 36e54f944..d09559d29 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderRootExec.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/broadcastsender/BroadcastSenderRootExec.java @@ -25,17 +25,14 @@ import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.MetricDef; -import org.apache.drill.exec.ops.OperatorContext; -import org.apache.drill.exec.ops.OperatorStats; import org.apache.drill.exec.physical.config.BroadcastSender; import org.apache.drill.exec.physical.impl.BaseRootExec; -import org.apache.drill.exec.physical.impl.RootExec; import org.apache.drill.exec.physical.impl.SendingAccountor; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.proto.ExecProtos; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; -import org.apache.drill.exec.proto.GeneralRPCProtos.Ack; import org.apache.drill.exec.proto.GeneralRPCProtos; +import org.apache.drill.exec.proto.GeneralRPCProtos.Ack; import org.apache.drill.exec.record.FragmentWritableBatch; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.WritableBatch; @@ -57,7 +54,7 @@ public class BroadcastSenderRootExec extends BaseRootExec { private final ExecProtos.FragmentHandle handle; private volatile boolean ok; private final RecordBatch incoming; - + public enum Metric implements MetricDef { N_RECEIVERS, BYTES_SENT; @@ -113,7 +110,7 @@ public class BroadcastSenderRootExec extends BaseRootExec { case OK: WritableBatch writableBatch = incoming.getWritableBatch(); if (tunnels.length > 1) { - writableBatch.retainBuffers(tunnels.length - 1); + writableBatch.retainBuffers(tunnels.length - 1); } for (int i = 0; i < tunnels.length; ++i) { FragmentWritableBatch batch = new FragmentWritableBatch(false, handle.getQueryId(), handle.getMajorFragmentId(), handle.getMinorFragmentId(), config.getOppositeMajorFragmentId(), i, writableBatch); @@ -134,10 +131,10 @@ public class BroadcastSenderRootExec extends BaseRootExec { throw new IllegalStateException(); } } - + public void updateStats(FragmentWritableBatch writableBatch) { stats.setLongStat(Metric.N_RECEIVERS, tunnels.length); - stats.addLongStat(Metric.BYTES_SENT, writableBatch.getByteCount()); + stats.addLongStat(Metric.BYTES_SENT, writableBatch.getByteCount()); } /* @@ -162,7 +159,7 @@ public class BroadcastSenderRootExec extends BaseRootExec { return true; } */ - + @Override public void stop() { ok = false; @@ -170,12 +167,12 @@ public class BroadcastSenderRootExec extends BaseRootExec { oContext.close(); incoming.cleanup(); } - + private StatusHandler statusHandler = new StatusHandler(); private class StatusHandler extends BaseRpcOutcomeListener<GeneralRPCProtos.Ack> { volatile RpcException ex; private final SendingAccountor sendCount = new SendingAccountor(); - + @Override public void success(Ack value, ByteBuf buffer) { sendCount.decrement(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java index 91d203763..195d24900 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java @@ -21,8 +21,6 @@ import java.io.IOException; import org.apache.drill.common.expression.ErrorCollector; import org.apache.drill.common.expression.ErrorCollectorImpl; -import org.apache.drill.common.expression.ExpressionPosition; -import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.logical.data.NamedExpression; import org.apache.drill.common.types.TypeProtos.MinorType; @@ -35,12 +33,10 @@ import org.apache.drill.exec.expr.ClassGenerator; import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; import org.apache.drill.exec.expr.CodeGenerator; import org.apache.drill.exec.expr.ExpressionTreeMaterializer; -import org.apache.drill.exec.expr.HoldingContainerExpression; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.expr.ValueVectorReadExpression; import org.apache.drill.exec.expr.ValueVectorWriteExpression; import org.apache.drill.exec.expr.fn.FunctionGenerationHelper; -import org.apache.drill.exec.expr.fn.impl.BitFunctions; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.MaterializedField; @@ -48,9 +44,7 @@ import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; -import com.google.common.collect.ImmutableList; import com.sun.codemodel.JConditional; import com.sun.codemodel.JExpr; @@ -58,40 +52,40 @@ import com.sun.codemodel.JExpr; public class ChainedHashTable { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ChainedHashTable.class); - private static final GeneratorMapping KEY_MATCH_BUILD = - GeneratorMapping.create("setupInterior" /* setup method */, "isKeyMatchInternalBuild" /* eval method */, + private static final GeneratorMapping KEY_MATCH_BUILD = + GeneratorMapping.create("setupInterior" /* setup method */, "isKeyMatchInternalBuild" /* eval method */, null /* reset */, null /* cleanup */); - private static final GeneratorMapping KEY_MATCH_PROBE = - GeneratorMapping.create("setupInterior" /* setup method */, "isKeyMatchInternalProbe" /* eval method */, + private static final GeneratorMapping KEY_MATCH_PROBE = + GeneratorMapping.create("setupInterior" /* setup method */, "isKeyMatchInternalProbe" /* eval method */, null /* reset */, null /* cleanup */); - private static final GeneratorMapping GET_HASH_BUILD = - GeneratorMapping.create("doSetup" /* setup method */, "getHashBuild" /* eval method */, + private static final GeneratorMapping GET_HASH_BUILD = + GeneratorMapping.create("doSetup" /* setup method */, "getHashBuild" /* eval method */, null /* reset */, null /* cleanup */); - private static final GeneratorMapping GET_HASH_PROBE = - GeneratorMapping.create("doSetup" /* setup method */, "getHashProbe" /* eval method */, + private static final GeneratorMapping GET_HASH_PROBE = + GeneratorMapping.create("doSetup" /* setup method */, "getHashProbe" /* eval method */, null /* reset */, null /* cleanup */); - private static final GeneratorMapping SET_VALUE = - GeneratorMapping.create("setupInterior" /* setup method */, "setValue" /* eval method */, + private static final GeneratorMapping SET_VALUE = + GeneratorMapping.create("setupInterior" /* setup method */, "setValue" /* eval method */, null /* reset */, null /* cleanup */); - - private static final GeneratorMapping OUTPUT_KEYS = + + private static final GeneratorMapping OUTPUT_KEYS = GeneratorMapping.create("setupInterior" /* setup method */, "outputRecordKeys" /* eval method */, null /* reset */, null /* cleanup */) ; // GM for putting constant expression into method "setupInterior" - private static final GeneratorMapping SETUP_INTERIOR_CONSTANT = - GeneratorMapping.create("setupInterior" /* setup method */, "setupInterior" /* eval method */, + private static final GeneratorMapping SETUP_INTERIOR_CONSTANT = + GeneratorMapping.create("setupInterior" /* setup method */, "setupInterior" /* eval method */, null /* reset */, null /* cleanup */); - // GM for putting constant expression into method "doSetup" - private static final GeneratorMapping DO_SETUP_CONSTANT = - GeneratorMapping.create("doSetup" /* setup method */, "doSetup" /* eval method */, + // GM for putting constant expression into method "doSetup" + private static final GeneratorMapping DO_SETUP_CONSTANT = + GeneratorMapping.create("doSetup" /* setup method */, "doSetup" /* eval method */, null /* reset */, null /* cleanup */); - + private final MappingSet KeyMatchIncomingBuildMapping = new MappingSet("incomingRowIdx", null, "incomingBuild", null, SETUP_INTERIOR_CONSTANT, KEY_MATCH_BUILD); private final MappingSet KeyMatchIncomingProbeMapping = new MappingSet("incomingRowIdx", null, "incomingProbe", null, SETUP_INTERIOR_CONSTANT, KEY_MATCH_PROBE); private final MappingSet KeyMatchHtableMapping = new MappingSet("htRowIdx", null, "htContainer", null, SETUP_INTERIOR_CONSTANT, KEY_MATCH_BUILD); @@ -109,10 +103,10 @@ public class ChainedHashTable { private final RecordBatch incomingProbe; private final RecordBatch outgoing; - public ChainedHashTable(HashTableConfig htConfig, + public ChainedHashTable(HashTableConfig htConfig, FragmentContext context, BufferAllocator allocator, - RecordBatch incomingBuild, + RecordBatch incomingBuild, RecordBatch incomingProbe, RecordBatch outgoing) { @@ -135,31 +129,31 @@ public class ChainedHashTable { if (isProbe) { keyExprsProbe = new LogicalExpression[htConfig.getKeyExprsProbe().length]; } - + ErrorCollector collector = new ErrorCollectorImpl(); VectorContainer htContainerOrig = new VectorContainer(); // original ht container from which others may be cloned LogicalExpression[] htKeyExprs = new LogicalExpression[htConfig.getKeyExprsBuild().length]; TypedFieldId[] htKeyFieldIds = new TypedFieldId[htConfig.getKeyExprsBuild().length]; int i = 0; - for (NamedExpression ne : htConfig.getKeyExprsBuild()) { + for (NamedExpression ne : htConfig.getKeyExprsBuild()) { final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incomingBuild, collector, context.getFunctionRegistry()); if(collector.hasErrors()) throw new SchemaChangeException("Failure while materializing expression. " + collector.toErrorString()); if (expr == null) continue; keyExprsBuild[i] = expr; - + final MaterializedField outputField = MaterializedField.create(ne.getRef(), expr.getMajorType()); // create a type-specific ValueVector for this key ValueVector vv = TypeHelper.getNewVector(outputField, allocator); vv.allocateNew(); htKeyFieldIds[i] = htContainerOrig.add(vv); - + i++; } if (isProbe) { i = 0; - for (NamedExpression ne : htConfig.getKeyExprsProbe()) { + for (NamedExpression ne : htConfig.getKeyExprsProbe()) { final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incomingProbe, collector, context.getFunctionRegistry()); if(collector.hasErrors()) throw new SchemaChangeException("Failure while materializing expression. " + collector.toErrorString()); if (expr == null) continue; @@ -189,9 +183,9 @@ public class ChainedHashTable { return ht; } - - private void setupIsKeyMatchInternal(ClassGenerator<HashTable> cg, MappingSet incomingMapping, MappingSet htableMapping, + + private void setupIsKeyMatchInternal(ClassGenerator<HashTable> cg, MappingSet incomingMapping, MappingSet htableMapping, LogicalExpression[] keyExprs, TypedFieldId[] htKeyFieldIds) throws SchemaChangeException { cg.setMappingSet(incomingMapping); @@ -202,10 +196,10 @@ public class ChainedHashTable { } int i = 0; - for (LogicalExpression expr : keyExprs) { + for (LogicalExpression expr : keyExprs) { cg.setMappingSet(incomingMapping); HoldingContainer left = cg.addExpr(expr, false); - + cg.setMappingSet(htableMapping); ValueVectorReadExpression vvrExpr = new ValueVectorReadExpression(htKeyFieldIds[i++]); HoldingContainer right = cg.addExpr(vvrExpr, false); @@ -216,7 +210,7 @@ public class ChainedHashTable { // check if two values are not equal (comparator result != 0) JConditional jc = cg.getEvalBlock()._if(out.getValue().ne(JExpr.lit(0))); - + jc._then()._return(JExpr.FALSE); } @@ -224,7 +218,7 @@ public class ChainedHashTable { cg.getEvalBlock()._return(JExpr.TRUE); } - private void setupSetValue(ClassGenerator<HashTable> cg, LogicalExpression[] keyExprs, TypedFieldId[] htKeyFieldIds) + private void setupSetValue(ClassGenerator<HashTable> cg, LogicalExpression[] keyExprs, TypedFieldId[] htKeyFieldIds) throws SchemaChangeException { cg.setMappingSet(SetValueMapping); @@ -234,7 +228,7 @@ public class ChainedHashTable { ValueVectorWriteExpression vvwExpr = new ValueVectorWriteExpression(htKeyFieldIds[i++], expr, true) ; HoldingContainer hc = cg.addExpr(vvwExpr, false); // this will write to the htContainer at htRowIdx - cg.getEvalBlock()._if(hc.getValue().eq(JExpr.lit(0)))._then()._return(JExpr.FALSE); + cg.getEvalBlock()._if(hc.getValue().eq(JExpr.lit(0)))._then()._return(JExpr.FALSE); } cg.getEvalBlock()._return(JExpr.TRUE); @@ -267,22 +261,22 @@ public class ChainedHashTable { cg.getEvalBlock()._return(JExpr.lit(0)); return; } - + HoldingContainer combinedHashValue = null; for (int i = 0; i < keyExprs.length; i++) { LogicalExpression expr = keyExprs[i]; - + cg.setMappingSet(incomingMapping); HoldingContainer input = cg.addExpr(expr, false); // compute the hash(expr) - LogicalExpression hashfunc = FunctionGenerationHelper.getFunctionExpression("hash", Types.required(MinorType.INT), context.getFunctionRegistry(), input); + LogicalExpression hashfunc = FunctionGenerationHelper.getFunctionExpression("hash", Types.required(MinorType.INT), context.getFunctionRegistry(), input); HoldingContainer hashValue = cg.addExpr(hashfunc, false); if (i == 0) { - combinedHashValue = hashValue; // first expression..just use the hash value - } + combinedHashValue = hashValue; // first expression..just use the hash value + } else { // compute the combined hash value using XOR diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTable.java index d9499c7ba..6028a04b4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTable.java @@ -17,10 +17,7 @@ */ package org.apache.drill.exec.physical.impl.common; -import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.exec.compile.TemplateClassDefinition; -import org.apache.drill.exec.expr.holders.BitHolder; -import org.apache.drill.exec.expr.holders.IntHolder; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java index 98892c069..fa6d4b5e9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableConfig.java @@ -34,8 +34,8 @@ public class HashTableConfig { private final NamedExpression[] keyExprsProbe; @JsonCreator - public HashTableConfig(@JsonProperty("initialCapacity") int initialCapacity, @JsonProperty("loadFactor") float loadFactor, - @JsonProperty("keyExprsBuild") NamedExpression[] keyExprsBuild, + public HashTableConfig(@JsonProperty("initialCapacity") int initialCapacity, @JsonProperty("loadFactor") float loadFactor, + @JsonProperty("keyExprsBuild") NamedExpression[] keyExprsBuild, @JsonProperty("keyExprsProbe") NamedExpression[] keyExprsProbe) { this.initialCapacity = initialCapacity; this.loadFactor = loadFactor; @@ -47,15 +47,15 @@ public class HashTableConfig { return initialCapacity; } - public float getLoadFactor() { + public float getLoadFactor() { return loadFactor; } - public NamedExpression[] getKeyExprsBuild() { + public NamedExpression[] getKeyExprsBuild() { return keyExprsBuild; } - public NamedExpression[] getKeyExprsProbe() { + public NamedExpression[] getKeyExprsProbe() { return keyExprsProbe; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java index e6c55bdbe..b03880cce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashTableTemplate.java @@ -23,18 +23,17 @@ import java.util.Iterator; import javax.inject.Named; import org.apache.drill.common.expression.SchemaPath; -import org.apache.drill.common.types.Types; import org.apache.drill.common.types.TypeProtos.MinorType; +import org.apache.drill.common.types.Types; +import org.apache.drill.exec.compile.sig.RuntimeOverridden; +import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.MaterializedField; +import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; -import org.apache.drill.exec.compile.sig.RuntimeOverridden; -import org.apache.drill.exec.expr.TypeHelper; -import org.apache.drill.exec.expr.holders.IntHolder; -import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.IntVector; import org.apache.drill.exec.vector.ValueVector; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/EvaluationPredicate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/EvaluationPredicate.java index dd0e26374..dc0abd961 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/EvaluationPredicate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/EvaluationPredicate.java @@ -21,10 +21,10 @@ import org.apache.drill.exec.record.selection.SelectionVector2; public class EvaluationPredicate { private SelectionVector2 vector; - + EvaluationPredicate(String pred){ - + } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterBatchCreator.java index c5c81c6e7..7f2fe8e24 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterBatchCreator.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.physical.impl.filter; import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Filter; import org.apache.drill.exec.physical.impl.BatchCreator; @@ -36,6 +35,6 @@ public class FilterBatchCreator implements BatchCreator<Filter>{ Preconditions.checkArgument(children.size() == 1); return new FilterRecordBatch(config, children.iterator().next(), context); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java index 3ece98beb..bf00194aa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java @@ -40,7 +40,6 @@ import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterSignature.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterSignature.java index 39519b476..74a5d1671 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterSignature.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterSignature.java @@ -24,8 +24,8 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; public interface FilterSignature extends CodeGeneratorSignature{ - + public void doSetup(@Named("context") FragmentContext context, @Named("incoming") RecordBatch incoming, @Named("outgoing") RecordBatch outgoing); public boolean doEval(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java index 5b0b88f54..bd8541847 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java @@ -28,7 +28,7 @@ import org.apache.drill.exec.record.selection.SelectionVector2; public abstract class FilterTemplate2 implements Filterer{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FilterTemplate2.class); - + private SelectionVector2 outgoingSelectionVector; private SelectionVector2 incomingSelectionVector; private SelectionVectorMode svMode; @@ -39,7 +39,7 @@ public abstract class FilterTemplate2 implements Filterer{ this.transfers = transfers; this.outgoingSelectionVector = outgoing.getSelectionVector2(); this.svMode = incoming.getSchema().getSelectionVectorMode(); - + switch(svMode){ case NONE: break; @@ -58,7 +58,7 @@ public abstract class FilterTemplate2 implements Filterer{ t.transfer(); } } - + public void filterBatch(int recordCount){ if (! outgoingSelectionVector.allocateNew(recordCount)) { throw new UnsupportedOperationException("Unable to allocate filter batch"); @@ -75,7 +75,7 @@ public abstract class FilterTemplate2 implements Filterer{ } doTransfers(); } - + private void filterBatchSV2(int recordCount){ int svIndex = 0; final int count = recordCount; @@ -99,7 +99,7 @@ public abstract class FilterTemplate2 implements Filterer{ } outgoingSelectionVector.setRecordCount(svIndex); } - + public abstract void doSetup(@Named("context") FragmentContext context, @Named("incoming") RecordBatch incoming, @Named("outgoing") RecordBatch outgoing); public abstract boolean doEval(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate4.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate4.java index cfb1f5b7c..a1769b90d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate4.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate4.java @@ -17,15 +17,13 @@ */ package org.apache.drill.exec.physical.impl.filter; +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.selection.SelectionVector4; -import org.apache.drill.exec.vector.allocator.VectorAllocator; - -import javax.inject.Named; public abstract class FilterTemplate4 implements Filterer { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FilterTemplate4.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/Filterer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/Filterer.java index 8e8cb2e72..fd7a13f65 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/Filterer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/Filterer.java @@ -25,10 +25,10 @@ import org.apache.drill.exec.record.TransferPair; public interface Filterer { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Filterer.class); - + public void setup(FragmentContext context, RecordBatch incoming, RecordBatch outgoing, TransferPair[] transfers) throws SchemaChangeException; public void filterBatch(int recordCount); - + public static TemplateClassDefinition<Filterer> TEMPLATE_DEFINITION2 = new TemplateClassDefinition<Filterer>(Filterer.class, FilterTemplate2.class); public static TemplateClassDefinition<Filterer> TEMPLATE_DEFINITION4 = new TemplateClassDefinition<Filterer>(Filterer.class, FilterTemplate4.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/ReturnValueExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/ReturnValueExpression.java index 1aa300635..c81fb2c93 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/ReturnValueExpression.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/ReturnValueExpression.java @@ -22,8 +22,8 @@ import java.util.Iterator; import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.common.expression.visitors.ExprVisitor; -import org.apache.drill.common.types.Types; import org.apache.drill.common.types.TypeProtos.MajorType; +import org.apache.drill.common.types.Types; import com.google.common.collect.Iterators; @@ -32,11 +32,11 @@ public class ReturnValueExpression implements LogicalExpression{ private LogicalExpression child; private boolean returnTrueOnOne; - + public ReturnValueExpression(LogicalExpression child) { this(child, true); } - + public ReturnValueExpression(LogicalExpression child, boolean returnTrueOnOne) { this.child = child; this.returnTrueOnOne = returnTrueOnOne; @@ -60,7 +60,7 @@ public class ReturnValueExpression implements LogicalExpression{ public ExpressionPosition getPosition() { return ExpressionPosition.UNKNOWN; } - + @Override public Iterator<LogicalExpression> iterator() { return Iterators.singletonIterator(child); @@ -70,12 +70,12 @@ public class ReturnValueExpression implements LogicalExpression{ return returnTrueOnOne; } - public int getSelfCost() { - throw new UnsupportedOperationException(String.format("The type of %s doesn't currently support LogicalExpression.getSelfCost().", this.getClass().getCanonicalName())); + public int getSelfCost() { + throw new UnsupportedOperationException(String.format("The type of %s doesn't currently support LogicalExpression.getSelfCost().", this.getClass().getCanonicalName())); } - - public int getCumulativeCost() { - throw new UnsupportedOperationException(String.format("The type of %s doesn't currently support LogicalExpression.getCumulativeCost().", this.getClass().getCanonicalName())); + + public int getCumulativeCost() { + throw new UnsupportedOperationException(String.format("The type of %s doesn't currently support LogicalExpression.getCumulativeCost().", this.getClass().getCanonicalName())); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatchCreator.java index d92595897..bfe89c020 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinBatchCreator.java @@ -17,7 +17,7 @@ */ package org.apache.drill.exec.physical.impl.join; -import com.google.common.base.Preconditions; +import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; @@ -25,7 +25,7 @@ import org.apache.drill.exec.physical.config.HashJoinPOP; import org.apache.drill.exec.physical.impl.BatchCreator; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.base.Preconditions; public class HashJoinBatchCreator implements BatchCreator<HashJoinPOP> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinHelper.java index aec0f31be..a3c33ed24 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinHelper.java @@ -18,17 +18,17 @@ package org.apache.drill.exec.physical.impl.join; +import io.netty.buffer.ByteBuf; + import java.util.ArrayList; import java.util.BitSet; import java.util.List; -import io.netty.buffer.ByteBuf; - import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.physical.impl.common.HashTable; +import org.apache.drill.exec.record.selection.SelectionVector4; /* @@ -71,7 +71,7 @@ public class HashJoinHelper { public static final int LEFT_INPUT = 0; public static final int RIGHT_INPUT = 1; - + public HashJoinHelper(FragmentContext context, BufferAllocator allocator) { this.context = context; this.allocator = allocator; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbe.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbe.java index ae703399d..7599f9e9f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbe.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbe.java @@ -18,20 +18,17 @@ package org.apache.drill.exec.physical.impl.join; +import java.io.IOException; + import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.impl.common.HashTable; -import org.apache.drill.exec.physical.impl.common.HashTableConfig; -import org.apache.drill.exec.record.ExpandableHyperContainer; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.VectorContainer; import org.eigenbase.rel.JoinRelType; -import java.io.IOException; - public interface HashJoinProbe { public static TemplateClassDefinition<HashJoinProbe> TEMPLATE_DEFINITION = new TemplateClassDefinition<HashJoinProbe>(HashJoinProbe.class, HashJoinProbeTemplate.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java index 0b90362f6..785deae79 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/HashJoinProbeTemplate.java @@ -17,23 +17,21 @@ */ package org.apache.drill.exec.physical.impl.join; +import java.io.IOException; +import java.util.List; + import javax.inject.Named; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.impl.common.HashTable; -import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.VectorContainer; -import org.apache.drill.exec.record.AbstractRecordBatch; - +import org.apache.drill.exec.record.VectorWrapper; import org.eigenbase.rel.JoinRelType; -import java.io.IOException; -import java.util.List; - public abstract class HashJoinProbeTemplate implements HashJoinProbe { // Probe side record batch diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinTemplate.java index c704a8a3d..bb3b9ac6d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinTemplate.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.physical.impl.join; import javax.inject.Named; -import org.apache.drill.common.logical.data.Join; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.MergeJoinPOP; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinWorker.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinWorker.java index 8643d662e..e4e13d1ec 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinWorker.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinWorker.java @@ -24,14 +24,14 @@ import org.apache.drill.exec.record.VectorContainer; public interface JoinWorker { - + public static enum JoinOutcome { NO_MORE_DATA, BATCH_RETURNED, SCHEMA_CHANGED, WAITING, FAILURE; } public void setupJoin(FragmentContext context, JoinStatus status, VectorContainer outgoing) throws SchemaChangeException; public boolean doJoin(JoinStatus status); - + public static TemplateClassDefinition<JoinWorker> TEMPLATE_DEFINITION = new TemplateClassDefinition<>(JoinWorker.class, JoinTemplate.class); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java index 7a6273c23..b24b5348a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinBatch.java @@ -505,7 +505,7 @@ public class MergeJoinBatch extends AbstractRecordBatch<MergeJoinPOP> { HoldingContainer out = cg.addExpr(fh, false); // If not 0, it means not equal. We return this out value. - // Null compares to Null should returns null (unknown). In such case, we return 1 to indicate they are not equal. + // Null compares to Null should returns null (unknown). In such case, we return 1 to indicate they are not equal. if (compareLeftExprHolder.isOptional() && compareRightExprHolder.isOptional()) { JConditional jc = cg.getEvalBlock()._if(compareLeftExprHolder.getIsSet().eq(JExpr.lit(0)). cand(compareRightExprHolder.getIsSet().eq(JExpr.lit(0)))); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinCreator.java index 3549a33bc..d6b566cce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/MergeJoinCreator.java @@ -37,8 +37,8 @@ public class MergeJoinCreator implements BatchCreator<MergeJoinPOP> { if(config.getJoinType() == JoinRelType.RIGHT){ return new MergeJoinBatch(config.flipIfRight(), context, children.get(1), children.get(0)); }else{ - return new MergeJoinBatch(config, context, children.get(0), children.get(1)); + return new MergeJoinBatch(config, context, children.get(0), children.get(1)); } - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitBatchCreator.java index ccbf755fa..e71dababa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitBatchCreator.java @@ -17,14 +17,15 @@ */ package org.apache.drill.exec.physical.impl.limit; -import com.google.common.collect.Iterables; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Limit; import org.apache.drill.exec.physical.impl.BatchCreator; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.collect.Iterables; public class LimitBatchCreator implements BatchCreator<Limit> { @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitRecordBatch.java index 32eb70909..f5bc9f91b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/limit/LimitRecordBatch.java @@ -23,13 +23,11 @@ import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Limit; -import org.apache.drill.exec.physical.impl.project.ProjectRecordBatch; import org.apache.drill.exec.record.AbstractSingleRecordBatch; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorWrapper; -import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.selection.SelectionVector2; import com.google.common.collect.Lists; @@ -37,7 +35,7 @@ import com.google.common.collect.Lists; public class LimitRecordBatch extends AbstractSingleRecordBatch<Limit> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(LimitRecordBatch.class); - + private SelectionVector2 outgoingSv; private SelectionVector2 incomingSv; private int recordsToSkip; @@ -96,7 +94,7 @@ public class LimitRecordBatch extends AbstractSingleRecordBatch<Limit> { if (first) { return produceEmptyFirstBatch(); } - + incoming.kill(true); IterOutcome upStream = incoming.next(); @@ -159,7 +157,7 @@ public class LimitRecordBatch extends AbstractSingleRecordBatch<Limit> { incoming.kill(true); return IterOutcome.OK_NEW_SCHEMA; } - + private void limitWithNoSV(int recordCount) { int offset = Math.max(0, Math.min(recordCount - 1, recordsToSkip)); recordsToSkip -= offset; @@ -211,5 +209,5 @@ public class LimitRecordBatch extends AbstractSingleRecordBatch<Limit> { outgoingSv.clear(); super.cleanup(); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java index 9d4a62979..cef41013f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/QueryWritableBatch.java @@ -17,27 +17,27 @@ */ package org.apache.drill.exec.physical.impl.materialize; +import io.netty.buffer.ByteBuf; + import java.util.Arrays; import java.util.List; -import com.google.common.collect.Lists; -import io.netty.buffer.ByteBuf; - import org.apache.drill.exec.proto.UserBitShared.QueryId; import org.apache.drill.exec.proto.UserBitShared.QueryResult; import org.apache.drill.exec.proto.UserBitShared.RecordBatchDef; import org.apache.drill.exec.proto.UserBitShared.SerializedField; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.MaterializedField; -import org.apache.drill.exec.record.WritableBatch; + +import com.google.common.collect.Lists; public class QueryWritableBatch { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryWritableBatch.class); - + private final QueryResult header; private final ByteBuf[] buffers; - - + + public QueryWritableBatch(QueryResult header, ByteBuf... buffers) { super(); this.header = header; @@ -55,7 +55,7 @@ public class QueryWritableBatch { } return n; } - + public QueryResult getHeader() { return header; } @@ -79,5 +79,5 @@ public class QueryWritableBatch { .build(); return new QueryWritableBatch(header); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/RecordMaterializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/RecordMaterializer.java index aa7f86ecf..221fc3437 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/RecordMaterializer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/RecordMaterializer.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.physical.impl.materialize; public interface RecordMaterializer { - + public QueryWritableBatch convertNext(boolean isLast); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java index b4e4871a9..cc1b3bf9f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/materialize/VectorRecordMaterializer.java @@ -35,7 +35,7 @@ public class VectorRecordMaterializer implements RecordMaterializer{ this.batch = batch; BatchSchema schema = batch.getSchema(); assert schema != null : "Schema must be defined."; - + // for (MaterializedField f : batch.getSchema()) { // logger.debug("New Field: {}", f); // } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java index 237f2f868..2885c529b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverGeneratorBase.java @@ -17,18 +17,16 @@ */ package org.apache.drill.exec.physical.impl.mergereceiver; +import static org.apache.drill.exec.compile.sig.GeneratorMapping.GM; + import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.compile.sig.MappingSet; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorAccessible; -import static org.apache.drill.exec.compile.sig.GeneratorMapping.GM; - public interface MergingReceiverGeneratorBase { - + public abstract void doSetup(FragmentContext context, VectorAccessible incoming, VectorAccessible outgoing) throws SchemaChangeException; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java index 002e0544f..c29ef75c7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingReceiverTemplate.java @@ -17,14 +17,12 @@ */ package org.apache.drill.exec.physical.impl.mergereceiver; +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorAccessible; -import javax.inject.Named; - public abstract class MergingReceiverTemplate implements MergingReceiverGeneratorBase { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MergingReceiverTemplate.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java index b8e18afa5..cf2e36f9d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/mergereceiver/MergingRecordBatch.java @@ -18,13 +18,14 @@ package org.apache.drill.exec.physical.impl.mergereceiver; * limitations under the License. */ +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.PriorityQueue; -import io.netty.buffer.ByteBuf; import org.apache.drill.common.expression.ErrorCollector; import org.apache.drill.common.expression.ErrorCollectorImpl; import org.apache.drill.common.expression.LogicalExpression; @@ -68,7 +69,6 @@ import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; import org.apache.drill.exec.vector.CopyUtil; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; import org.eigenbase.rel.RelFieldCollation.Direction; import parquet.Preconditions; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjector.java index 2265150fc..3213d1146 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjector.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.physical.impl.orderedpartitioner; +import java.util.List; + import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; @@ -26,8 +28,6 @@ import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorContainer; -import java.util.List; - public interface OrderedPartitionProjector { public abstract void setup(FragmentContext context, VectorAccessible incoming, RecordBatch outgoing, List<TransferPair> transfers, diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjectorTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjectorTemplate.java index 339844360..f5068b4aa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjectorTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/OrderedPartitionProjectorTemplate.java @@ -17,7 +17,10 @@ */ package org.apache.drill.exec.physical.impl.orderedpartitioner; -import com.google.common.collect.ImmutableList; +import java.util.List; + +import javax.inject.Named; + import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; @@ -30,8 +33,7 @@ import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.IntVector; -import javax.inject.Named; -import java.util.List; +import com.google.common.collect.ImmutableList; public abstract class OrderedPartitionProjectorTemplate implements OrderedPartitionProjector { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(OrderedPartitionProjectorTemplate.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleCopierTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleCopierTemplate.java index 73fcd1fd7..1371e1ce2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleCopierTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleCopierTemplate.java @@ -17,16 +17,16 @@ */ package org.apache.drill.exec.physical.impl.orderedpartitioner; +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.selection.SelectionVector4; -import javax.inject.Named; - public abstract class SampleCopierTemplate implements SampleCopier { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SampleCopierTemplate.class); - + private SelectionVector4 sv4; private int outputRecords = 0; @@ -41,7 +41,7 @@ public abstract class SampleCopierTemplate implements SampleCopier { public int getOutputRecords() { return outputRecords; } - + @Override public boolean copyRecords(int skip, int start, int total) { @@ -57,10 +57,10 @@ public abstract class SampleCopierTemplate implements SampleCopier { } return true; } - + public abstract void doSetup(@Named("context") FragmentContext context, @Named("incoming") VectorAccessible incoming, @Named("outgoing") VectorAccessible outgoing); public abstract boolean doEval(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSortTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSortTemplate.java index 5a8354142..3d5c548b2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSortTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSortTemplate.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.physical.impl.orderedpartitioner; +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; @@ -25,8 +27,6 @@ import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.hadoop.util.IndexedSortable; import org.apache.hadoop.util.QuickSort; -import javax.inject.Named; - public abstract class SampleSortTemplate implements SampleSorter, IndexedSortable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SampleSortTemplate.class); @@ -36,7 +36,7 @@ public abstract class SampleSortTemplate implements SampleSorter, IndexedSortabl this.vector2 = vector2; doSetup(context, sampleBatch, null); } - + @Override public void sort(SelectionVector2 vector2, VectorContainer container){ QuickSort qs = new QuickSort(); @@ -49,7 +49,7 @@ public abstract class SampleSortTemplate implements SampleSorter, IndexedSortabl vector2.setIndex(sv0, vector2.getIndex(sv1)); vector2.setIndex(sv1, tmp); } - + @Override public int compare(int leftIndex, int rightIndex) { return doEval(leftIndex, rightIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSorter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSorter.java index b58f15ed1..1eb5790ad 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSorter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/orderedpartitioner/SampleSorter.java @@ -27,7 +27,7 @@ import org.apache.drill.exec.record.selection.SelectionVector2; public interface SampleSorter { public void setup(FragmentContext context, RecordBatch hyperBatch) throws SchemaChangeException; public void sort(SelectionVector2 vector2, VectorContainer container); - + public static TemplateClassDefinition<SampleSorter> TEMPLATE_DEFINITION = new TemplateClassDefinition<SampleSorter>(SampleSorter.class, SampleSortTemplate.class); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderCreator.java index 2ced9dd5d..06fd1155a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderCreator.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.physical.impl.partitionsender; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.HashPartitionSender; import org.apache.drill.exec.physical.impl.RootCreator; import org.apache.drill.exec.physical.impl.RootExec; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; public class PartitionSenderCreator implements RootCreator<HashPartitionSender> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderRootExec.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderRootExec.java index 14cf092ee..6ff041879 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderRootExec.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionSenderRootExec.java @@ -66,10 +66,10 @@ public class PartitionSenderRootExec extends BaseRootExec { private final AtomicIntegerArray remainingReceivers; private final AtomicInteger remaingReceiverCount; private volatile boolean done = false; - + long minReceiverRecordCount = Long.MAX_VALUE; long maxReceiverRecordCount = Long.MIN_VALUE; - + public enum Metric implements MetricDef { BATCHES_SENT, RECORDS_SENT, @@ -249,7 +249,7 @@ public class PartitionSenderRootExec extends BaseRootExec { } } } - + public void stop() { logger.debug("Partition sender stopping."); ok = false; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/Partitioner.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/Partitioner.java index c5fe154ab..5ed9c392f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/Partitioner.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/Partitioner.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.physical.impl.partitionsender; +import java.io.IOException; +import java.util.List; + import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; @@ -26,9 +29,6 @@ import org.apache.drill.exec.physical.config.HashPartitionSender; import org.apache.drill.exec.physical.impl.SendingAccountor; import org.apache.drill.exec.record.RecordBatch; -import java.io.IOException; -import java.util.List; - public interface Partitioner { public abstract void setup(FragmentContext context, diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionerTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionerTemplate.java index 3141aed1b..338a704ca 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionerTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionerTemplate.java @@ -35,7 +35,6 @@ import org.apache.drill.exec.physical.config.HashPartitionSender; import org.apache.drill.exec.physical.impl.SendingAccountor; import org.apache.drill.exec.physical.impl.partitionsender.PartitionSenderRootExec.Metric; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; -import org.apache.drill.exec.proto.ExecProtos; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; @@ -324,7 +323,7 @@ public abstract class PartitionerTemplate implements Partitioner { throw new IOException(statusHandler.getException()); } } - + public void updateStats(FragmentWritableBatch writableBatch) { stats.addLongStat(Metric.BYTES_SENT, writableBatch.getByteCount()); stats.addLongStat(Metric.BATCHES_SENT, 1); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/StatusHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/StatusHandler.java index 7c3fd52df..469140c96 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/StatusHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/StatusHandler.java @@ -19,6 +19,7 @@ package org.apache.drill.exec.physical.impl.partitionsender; import io.netty.buffer.ByteBuf; + import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.impl.SendingAccountor; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatch.java index 91d364751..051a590f2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatch.java @@ -17,8 +17,11 @@ */ package org.apache.drill.exec.physical.impl.producer; +import java.util.concurrent.BlockingDeque; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.LinkedBlockingDeque; + import org.apache.drill.common.types.TypeProtos.MajorType; -import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; @@ -29,20 +32,11 @@ import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; -import org.apache.drill.exec.record.WritableBatch; import org.apache.drill.exec.vector.ValueVector; -import java.util.Queue; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingDeque; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingDeque; - public class ProducerConsumerBatch extends AbstractRecordBatch { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProducerConsumerBatch.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatchCreator.java index 0fcf4f358..c568ed4d4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/producer/ProducerConsumerBatchCreator.java @@ -17,16 +17,15 @@ */ package org.apache.drill.exec.physical.impl.producer; -import com.google.common.collect.Iterables; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.config.Limit; import org.apache.drill.exec.physical.config.ProducerConsumer; import org.apache.drill.exec.physical.impl.BatchCreator; -import org.apache.drill.exec.physical.impl.producer.ProducerConsumerBatch; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.collect.Iterables; public class ProducerConsumerBatchCreator implements BatchCreator<ProducerConsumer> { @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java index 734088e12..ec29cac55 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java @@ -54,7 +54,6 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Project; import org.apache.drill.exec.planner.StarColumnHelper; import org.apache.drill.exec.record.AbstractSingleRecordBatch; -import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatch; @@ -82,8 +81,8 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ private int recordCount; private static final String EMPTY_STRING = ""; - - private class ClassifierResult { + + private class ClassifierResult { public boolean isStar = false; public List<String> outputNames; public String prefix = ""; @@ -91,13 +90,13 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ public CaseInsensitiveMap outputMap = new CaseInsensitiveMap(); private CaseInsensitiveMap sequenceMap = new CaseInsensitiveMap(); - private void clear() { + private void clear() { isStar = false; prefix = ""; - if (outputNames != null) { + if (outputNames != null) { outputNames.clear(); } - + // note: don't clear the internal maps since they have cumulative data.. } } @@ -128,6 +127,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ return super.innerNext(); } + @Override public VectorContainer getOutgoingContainer() { return this.container; } @@ -262,17 +262,17 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ IntOpenHashSet transferFieldIds = new IntOpenHashSet(); boolean isAnyWildcard = false; - - ClassifierResult result = new ClassifierResult(); + + ClassifierResult result = new ClassifierResult(); boolean classify = isClassificationNeeded(exprs); - + for(int i = 0; i < exprs.size(); i++){ final NamedExpression namedExpression = exprs.get(i); result.clear(); - + if (classify && namedExpression.getExpr() instanceof SchemaPath) { classifyExpr(namedExpression, incoming, result); - + if (result.isStar) { isAnyWildcard = true; Integer value = result.prefixMap.get(result.prefix); @@ -284,12 +284,12 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ if (k > result.outputNames.size()-1) { assert false; } - String name = result.outputNames.get(k++); // get the renamed column names + String name = result.outputNames.get(k++); // get the renamed column names if (name == EMPTY_STRING) continue; FieldReference ref = new FieldReference(name); TransferPair tp = wrapper.getValueVector().getTransferPair(ref); transfers.add(tp); - container.add(tp.getTo()); + container.add(tp.getTo()); } } else if (value != null && value.intValue() > 1) { // subsequent wildcards should do a copy of incoming valuevectors int k = 0; @@ -305,7 +305,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ final LogicalExpression expr = ExpressionTreeMaterializer.materialize(originalPath, incoming, collector, context.getFunctionRegistry() ); if(collector.hasErrors()){ throw new SchemaChangeException(String.format("Failure while trying to materialize incoming schema. Errors:\n %s.", collector.toErrorString())); - } + } MaterializedField outputField = MaterializedField.create(name, expr.getMajorType()); ValueVector vv = TypeHelper.getNewVector(outputField, oContext.getAllocator()); @@ -330,7 +330,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ } } } - + final LogicalExpression expr = ExpressionTreeMaterializer.materialize(namedExpression.getExpr(), incoming, collector, context.getFunctionRegistry(), true); final MaterializedField outputField = MaterializedField.create(outputName, expr.getMajorType()); if(collector.hasErrors()){ @@ -426,7 +426,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ NameSegment ref = ex.getRef().getRootSegment(); boolean refHasPrefix = ref.getPath().contains(StarColumnHelper.PREFIX_DELIMITER); boolean exprContainsStar = expr.getPath().contains(StarColumnHelper.STAR_COLUMN); - + if (refHasPrefix || exprContainsStar) { needed = true; break; @@ -434,19 +434,19 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ } return needed; } - + private String getUniqueName(String name, ClassifierResult result) { Integer currentSeq = (Integer) result.sequenceMap.get(name); if (currentSeq == null) { // name is unique, so return the original name Integer n = -1; result.sequenceMap.put(name, n); - return name; + return name; } // create a new name Integer newSeq = currentSeq + 1; - result.sequenceMap.put(name, newSeq); - - String newName = name + newSeq; + result.sequenceMap.put(name, newSeq); + + String newName = name + newSeq; return newName; } @@ -462,8 +462,8 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ result.outputNames.add(EMPTY_STRING); } } - - private void classifyExpr(NamedExpression ex, RecordBatch incoming, ClassifierResult result) { + + private void classifyExpr(NamedExpression ex, RecordBatch incoming, ClassifierResult result) { NameSegment expr = ((SchemaPath)ex.getExpr()).getRootSegment(); NameSegment ref = ex.getRef().getRootSegment(); boolean exprHasPrefix = expr.getPath().contains(StarColumnHelper.PREFIX_DELIMITER); @@ -475,11 +475,11 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ String exprPrefix = EMPTY_STRING; String exprSuffix = expr.getPath(); - + if (exprHasPrefix) { // get the prefix of the expr String[] exprComponents = expr.getPath().split(StarColumnHelper.PREFIX_DELIMITER, 2); - assert(exprComponents.length == 2); + assert(exprComponents.length == 2); exprPrefix = exprComponents[0]; exprSuffix = exprComponents[1]; result.prefix = exprPrefix; @@ -496,18 +496,18 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ result.prefixMap.put(exprPrefix, n); } } - + int incomingSchemaSize = incoming.getSchema().getFieldCount(); - // for debugging.. + // for debugging.. // if (incomingSchemaSize > 9) { // assert false; // } - + // input is '*' and output is 'prefix_*' - if (exprIsStar && refHasPrefix && refEndsWithStar) { + if (exprIsStar && refHasPrefix && refEndsWithStar) { String[] components = ref.getPath().split(StarColumnHelper.PREFIX_DELIMITER, 2); - assert(components.length == 2); + assert(components.length == 2); String prefix = components[0]; result.outputNames = Lists.newArrayList(); for(VectorWrapper<?> wrapper : incoming) { @@ -518,7 +518,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ String newName = prefix + StarColumnHelper.PREFIX_DELIMITER + name; addToResultMaps(newName, result, false); } - } + } // input and output are the same else if (expr.getPath().equals(ref.getPath())) { if (exprContainsStar && exprHasPrefix) { @@ -533,16 +533,16 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ for(VectorWrapper<?> wrapper : incoming) { ValueVector vvIn = wrapper.getValueVector(); String incomingName = vvIn.getField().getPath().getRootSegment().getPath(); - // get the prefix of the name + // get the prefix of the name String[] nameComponents = incomingName.split(StarColumnHelper.PREFIX_DELIMITER, 2); // if incoming valuevector does not have a prefix, ignore it since this expression is not referencing it if (nameComponents.length <= 1) { k++; continue; - } + } String namePrefix = nameComponents[0]; if (exprPrefix.equals(namePrefix)) { - String newName = incomingName; + String newName = incomingName; if (!result.outputMap.containsKey(newName)) { result.outputNames.set(k, newName); result.outputMap.put(newName, newName); @@ -593,13 +593,13 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ if (components.length <= 1) { k++; continue; - } + } String namePrefix = components[0]; String nameSuffix = components[1]; if (exprPrefix.equals(namePrefix)) { if (refContainsStar) { - // remove the prefix from the incoming column names - String newName = getUniqueName(nameSuffix, result); // for top level we need to make names unique + // remove the prefix from the incoming column names + String newName = getUniqueName(nameSuffix, result); // for top level we need to make names unique result.outputNames.set(k, newName); } else if (exprSuffix.equals(nameSuffix)) { // example: ref: $f1, expr: T0<PREFIX><column_name> @@ -611,15 +611,15 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ } k++; } - } + } // input and output have prefixes although they could be different... else if (exprHasPrefix && refHasPrefix) { String[] input = expr.getPath().split(StarColumnHelper.PREFIX_DELIMITER, 2); - assert(input.length == 2); - assert false : "Unexpected project expression or reference"; // not handled yet - } + assert(input.length == 2); + assert false : "Unexpected project expression or reference"; // not handled yet + } else { - // if the incoming schema's column name matches the expression name of the Project, + // if the incoming schema's column name matches the expression name of the Project, // then we just want to pick the ref name as the output column name result.outputNames = Lists.newArrayListWithCapacity(incomingSchemaSize); for (int j=0; j < incomingSchemaSize; j++) { @@ -629,10 +629,10 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ int k = 0; for(VectorWrapper<?> wrapper : incoming) { ValueVector vvIn = wrapper.getValueVector(); - String incomingName = vvIn.getField().getPath().getRootSegment().getPath(); + String incomingName = vvIn.getField().getPath().getRootSegment().getPath(); if (expr.getPath().equals(incomingName)) { - String newName = ref.getPath(); + String newName = ref.getPath(); if (!result.outputMap.containsKey(newName)) { result.outputNames.set(k, newName); result.outputMap.put(newName, newName); @@ -640,7 +640,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project>{ } k++; } - } + } } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/RecordBatchData.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/RecordBatchData.java index 02cad5a78..8116869c4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/RecordBatchData.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/RecordBatchData.java @@ -35,11 +35,11 @@ import com.google.common.collect.Lists; */ public class RecordBatchData { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RecordBatchData.class); - + private SelectionVector2 sv2; private int recordCount; VectorContainer container = new VectorContainer(); - + public RecordBatchData(VectorAccessible batch){ List<ValueVector> vectors = Lists.newArrayList(); if (batch instanceof RecordBatch && batch.getSchema().getSelectionVectorMode() == SelectionVectorMode.TWO_BYTE) { @@ -47,7 +47,7 @@ public class RecordBatchData { } else { this.sv2 = null; } - + for(VectorWrapper<?> v : batch){ if(v.isHyper()) throw new UnsupportedOperationException("Record batch data can't be created based on a hyper batch."); TransferPair tp = v.getValueVector().getTransferPair(); @@ -66,7 +66,7 @@ public class RecordBatchData { container = VectorContainer.canonicalize(container); container.buildSchema(mode); } - + public int getRecordCount(){ return recordCount; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatch.java index dbb547dca..3a374910c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatch.java @@ -32,7 +32,6 @@ import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer; import org.apache.drill.exec.expr.CodeGenerator; import org.apache.drill.exec.expr.ExpressionTreeMaterializer; import org.apache.drill.exec.expr.fn.FunctionGenerationHelper; -import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Sort; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatchCreator.java index cd5079fca..217acf216 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortBatchCreator.java @@ -35,6 +35,6 @@ public class SortBatchCreator implements BatchCreator<Sort>{ Preconditions.checkArgument(children.size() == 1); return new SortBatch(config, context, children.iterator().next()); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java index e3971cbc3..593db0dee 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/SortTemplate.java @@ -17,10 +17,10 @@ */ package org.apache.drill.exec.physical.impl.sort; +import java.util.concurrent.TimeUnit; + import javax.inject.Named; -import com.google.common.base.Preconditions; -import com.google.common.base.Stopwatch; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; @@ -29,21 +29,22 @@ import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.hadoop.util.IndexedSortable; import org.apache.hadoop.util.QuickSort; -import java.util.concurrent.TimeUnit; +import com.google.common.base.Preconditions; +import com.google.common.base.Stopwatch; public abstract class SortTemplate implements Sorter, IndexedSortable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SortTemplate.class); - + private SelectionVector4 vector4; - + public void setup(FragmentContext context, SelectionVector4 vector4, VectorContainer hyperBatch) throws SchemaChangeException{ // we pass in the local hyperBatch since that is where we'll be reading data. Preconditions.checkNotNull(vector4); this.vector4 = vector4; doSetup(context, hyperBatch, null); } - + @Override public void sort(SelectionVector4 vector4, VectorContainer container){ Stopwatch watch = new Stopwatch(); @@ -59,7 +60,7 @@ public abstract class SortTemplate implements Sorter, IndexedSortable{ vector4.set(sv0, vector4.get(sv1)); vector4.set(sv1, tmp); } - + @Override public int compare(int leftIndex, int rightIndex) { int sv1 = vector4.get(leftIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/Sorter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/Sorter.java index dcb159c60..eb8dfdf3e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/Sorter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/sort/Sorter.java @@ -20,14 +20,13 @@ package org.apache.drill.exec.physical.impl.sort; import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.selection.SelectionVector4; public interface Sorter { public void setup(FragmentContext context, SelectionVector4 vector4, VectorContainer hyperBatch) throws SchemaChangeException; public void sort(SelectionVector4 vector4, VectorContainer container); - + public static TemplateClassDefinition<Sorter> TEMPLATE_DEFINITION = new TemplateClassDefinition<Sorter>(Sorter.class, SortTemplate.class); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/Copier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/Copier.java index dfc37c6ac..8ead6ab93 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/Copier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/Copier.java @@ -21,7 +21,6 @@ import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.vector.allocator.VectorAllocator; public interface Copier { public static TemplateClassDefinition<Copier> TEMPLATE_DEFINITION2 = new TemplateClassDefinition<Copier>(Copier.class, CopierTemplate2.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/CopierTemplate4.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/CopierTemplate4.java index 7a1c0290f..c42332d81 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/CopierTemplate4.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/CopierTemplate4.java @@ -23,9 +23,7 @@ import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.VectorWrapper; -import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; -import org.apache.drill.exec.vector.allocator.VectorAllocator; public abstract class CopierTemplate4 implements Copier{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CopierTemplate4.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java index 4ca2cdfba..97f3608b2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/RemovingRecordBatch.java @@ -23,26 +23,19 @@ import java.util.List; import org.apache.drill.exec.exception.ClassTransformationException; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.CodeGenerator; -import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.record.AbstractSingleRecordBatch; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; -import org.apache.drill.exec.record.HyperVectorWrapper; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.WritableBatch; import org.apache.drill.exec.vector.CopyUtil; -import org.apache.drill.exec.vector.FixedWidthVector; import org.apache.drill.exec.vector.ValueVector; -import org.apache.drill.exec.vector.VariableWidthVector; -import org.apache.drill.exec.vector.allocator.FixedVectorAllocator; -import org.apache.drill.exec.vector.allocator.VariableEstimatedVector; -import org.apache.drill.exec.vector.allocator.VectorAllocator; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; @@ -186,6 +179,7 @@ public class RemovingRecordBatch extends AbstractSingleRecordBatch<SelectionVect incoming.getSchema())); } + @Override public void cleanup(){ super.cleanup(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/SVRemoverCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/SVRemoverCreator.java index a932b4499..455a5f920 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/SVRemoverCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/SVRemoverCreator.java @@ -35,6 +35,6 @@ public class SVRemoverCreator implements BatchCreator<SelectionVectorRemover>{ Preconditions.checkArgument(children.size() == 1); return new RemovingRecordBatch(config, context, children.iterator().next()); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceBatchCreator.java index a24ec705a..12afa3303 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceBatchCreator.java @@ -18,16 +18,14 @@ package org.apache.drill.exec.physical.impl.trace; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Trace; import org.apache.drill.exec.physical.impl.BatchCreator; import org.apache.drill.exec.record.RecordBatch; -import com.google.common.base.Preconditions; - -import java.util.List; - public class TraceBatchCreator implements BatchCreator<Trace> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TraceBatchCreator.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceRecordBatch.java index b012cec1d..609cb29bb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/trace/TraceRecordBatch.java @@ -27,8 +27,6 @@ import org.apache.drill.exec.cache.VectorAccessibleSerializable; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.Trace; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; -import org.apache.drill.exec.proto.helper.QueryIdHelper; import org.apache.drill.exec.record.AbstractSingleRecordBatch; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.RecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllBatchCreator.java index 395cab425..7f7e11038 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllBatchCreator.java @@ -35,6 +35,6 @@ public class UnionAllBatchCreator implements BatchCreator<UnionAll>{ Preconditions.checkArgument(children.size() >= 1); return new UnionAllRecordBatch(config, children, context); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java index 1f2f8430d..6b83d04ee 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java @@ -149,7 +149,7 @@ public class UnionAllRecordBatch extends AbstractRecordBatch<UnionAll> { public WritableBatch getWritableBatch() { return WritableBatch.get(this); } - + @Override public void cleanup() { super.cleanup(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java index 16a68b809..8e7d9c623 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java @@ -17,10 +17,11 @@ */ package org.apache.drill.exec.physical.impl.unorderedreceiver; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.util.Iterator; -import io.netty.buffer.ByteBuf; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.OutOfMemoryException; @@ -46,7 +47,6 @@ import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; -import org.apache.drill.exec.rpc.control.ControlTunnel.ReceiverFinished; public class UnorderedReceiverBatch implements RecordBatch { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UnorderedReceiverBatch.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverCreator.java index 6be87143a..d9864f976 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverCreator.java @@ -36,12 +36,12 @@ public class UnorderedReceiverCreator implements BatchCreator<UnorderedReceiver> assert children == null || children.isEmpty(); IncomingBuffers bufHolder = context.getBuffers(); assert bufHolder != null : "IncomingBuffers must be defined for any place a receiver is declared."; - + RawBatchBuffer[] buffers = bufHolder.getBuffers(receiver.getOppositeMajorFragmentId()); assert buffers.length == 1; RawBatchBuffer buffer = buffers[0]; return new UnorderedReceiverBatch(context, buffer, receiver); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/validate/IteratorValidatorBatchIterator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/validate/IteratorValidatorBatchIterator.java index 14110e374..0e69bcf71 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/validate/IteratorValidatorBatchIterator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/validate/IteratorValidatorBatchIterator.java @@ -21,7 +21,6 @@ import java.util.Iterator; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.record.AbstractRecordBatch; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.TypedFieldId; @@ -153,7 +152,7 @@ public class IteratorValidatorBatchIterator implements RecordBatch { public void cleanup() { incoming.cleanup(); } - + @Override public VectorContainer getOutgoingContainer() { throw new UnsupportedOperationException(String.format(" You should not call getOutgoingContainer() for class %s", this.getClass().getCanonicalName())); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatchCreator.java index 0078e18a6..eb5d83bf4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/ExternalSortBatchCreator.java @@ -17,14 +17,15 @@ */ package org.apache.drill.exec.physical.impl.xsort; -import com.google.common.base.Preconditions; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.config.ExternalSort; import org.apache.drill.exec.physical.impl.BatchCreator; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; +import com.google.common.base.Preconditions; public class ExternalSortBatchCreator implements BatchCreator<ExternalSort>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExternalSortBatchCreator.class); @@ -34,6 +35,6 @@ public class ExternalSortBatchCreator implements BatchCreator<ExternalSort>{ Preconditions.checkArgument(children.size() == 1); return new ExternalSortBatch(config, context, children.iterator().next()); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java index 0c98c6fd3..df79b1acb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSortTemplate.java @@ -17,9 +17,10 @@ */ package org.apache.drill.exec.physical.impl.xsort; -import com.google.common.base.Preconditions; -import com.google.common.base.Stopwatch; -import com.google.common.collect.Queues; +import java.util.Queue; + +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; @@ -28,8 +29,9 @@ import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.hadoop.util.IndexedSortable; -import javax.inject.Named; -import java.util.Queue; +import com.google.common.base.Preconditions; +import com.google.common.base.Stopwatch; +import com.google.common.collect.Queues; public abstract class MSortTemplate implements MSorter, IndexedSortable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MSortTemplate.class); @@ -93,7 +95,7 @@ public abstract class MSortTemplate implements MSorter, IndexedSortable{ public SelectionVector4 getSV4() { return vector4; } - + @Override public void sort(VectorContainer container){ Stopwatch watch = new Stopwatch(); @@ -137,7 +139,7 @@ public abstract class MSortTemplate implements MSorter, IndexedSortable{ vector4.set(sv0, vector4.get(sv1)); vector4.set(sv1, tmp); } - + @Override public int compare(int leftIndex, int rightIndex) { int sv1 = vector4.get(leftIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSorter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSorter.java index 1300830f6..e80d30903 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSorter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/MSorter.java @@ -28,7 +28,7 @@ public interface MSorter { public void setup(FragmentContext context, BufferAllocator allocator, SelectionVector4 vector4, VectorContainer hyperBatch) throws SchemaChangeException; public void sort(VectorContainer container); public SelectionVector4 getSV4(); - + public static TemplateClassDefinition<MSorter> TEMPLATE_DEFINITION = new TemplateClassDefinition<MSorter>(MSorter.class, MSortTemplate.class); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopier.java index 0eda0a6d2..4da3c3604 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopier.java @@ -17,20 +17,15 @@ */ package org.apache.drill.exec.physical.impl.xsort; +import java.util.List; + import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.impl.sort.RecordBatchData; -import org.apache.drill.exec.physical.impl.svremover.Copier; -import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.record.VectorAccessible; -import org.apache.drill.exec.record.VectorContainer; -import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.drill.exec.vector.allocator.VectorAllocator; -import java.util.List; - public interface PriorityQueueCopier { public void setup(FragmentContext context, BufferAllocator allocator, VectorAccessible hyperBatch, List<BatchGroup> batchGroups, VectorAccessible outgoing, List<VectorAllocator> allocators) throws SchemaChangeException; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopierTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopierTemplate.java index b1c316ca1..951397c80 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopierTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/PriorityQueueCopierTemplate.java @@ -31,7 +31,7 @@ import org.apache.drill.exec.vector.allocator.VectorAllocator; public abstract class PriorityQueueCopierTemplate implements PriorityQueueCopier { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PriorityQueueCopierTemplate.class); - + private SelectionVector4 vector4; private List<BatchGroup> batchGroups; private VectorAccessible hyperBatch; @@ -165,7 +165,7 @@ public abstract class PriorityQueueCopierTemplate implements PriorityQueueCopier vector4.set(sv0, vector4.get(sv1)); vector4.set(sv1, tmp); } - + public int compare(int leftIndex, int rightIndex) { int sv1 = vector4.get(leftIndex); int sv2 = vector4.get(rightIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorter.java index 761e4214d..b37229d2e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorter.java @@ -20,16 +20,13 @@ package org.apache.drill.exec.physical.impl.xsort; import org.apache.drill.exec.compile.TemplateClassDefinition; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.impl.sort.SortTemplate; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.selection.SelectionVector2; -import org.apache.drill.exec.record.selection.SelectionVector4; public interface SingleBatchSorter { public void setup(FragmentContext context, SelectionVector2 vector2, RecordBatch incoming) throws SchemaChangeException; public void sort(SelectionVector2 vector2); - + public static TemplateClassDefinition<SingleBatchSorter> TEMPLATE_DEFINITION = new TemplateClassDefinition<SingleBatchSorter>(SingleBatchSorter.class, SingleBatchSorterTemplate.class); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java index 3cb764164..75892f9be 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/SingleBatchSorterTemplate.java @@ -17,20 +17,19 @@ */ package org.apache.drill.exec.physical.impl.xsort; -import com.google.common.base.Preconditions; -import com.google.common.base.Stopwatch; +import java.util.concurrent.TimeUnit; + +import javax.inject.Named; + import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.impl.sort.Sorter; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.selection.SelectionVector2; -import org.apache.drill.exec.record.selection.SelectionVector4; import org.apache.hadoop.util.IndexedSortable; import org.apache.hadoop.util.QuickSort; -import javax.inject.Named; -import java.util.concurrent.TimeUnit; +import com.google.common.base.Preconditions; +import com.google.common.base.Stopwatch; public abstract class SingleBatchSorterTemplate implements SingleBatchSorter, IndexedSortable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SingleBatchSorterTemplate.class); @@ -42,7 +41,7 @@ public abstract class SingleBatchSorterTemplate implements SingleBatchSorter, In this.vector2 = vector2; doSetup(context, incoming, null); } - + @Override public void sort(SelectionVector2 vector2){ QuickSort qs = new QuickSort(); @@ -60,7 +59,7 @@ public abstract class SingleBatchSorterTemplate implements SingleBatchSorter, In vector2.setIndex(sv0, vector2.getIndex(sv1)); vector2.setIndex(sv1, tmp); } - + @Override public int compare(int leftIndex, int rightIndex) { char sv1 = vector2.getIndex(leftIndex); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/StarColumnHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/StarColumnHelper.java index 591faf9ca..aa2f78665 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/StarColumnHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/StarColumnHelper.java @@ -24,26 +24,26 @@ import java.util.Set; import org.eigenbase.reltype.RelDataType; public class StarColumnHelper { - + public final static String PREFIX_DELIMITER = "\u00a6\u00a6"; public final static String STAR_COLUMN = "*"; - + public final static String PREFIXED_STAR_COLUMN = PREFIX_DELIMITER + STAR_COLUMN; - + public static boolean containsStarColumn(RelDataType type) { List<String> fieldNames = type.getFieldNames(); - + for (String s : fieldNames) { if (s.startsWith(STAR_COLUMN)) return true; } - + return false; } - + public static boolean isPrefixedStarColumn(String fieldName) { - return fieldName.indexOf(PREFIXED_STAR_COLUMN) > 0 ; // the delimiter * starts at none-zero position. + return fieldName.indexOf(PREFIXED_STAR_COLUMN) > 0 ; // the delimiter * starts at none-zero position. } public static boolean isNonPrefixedStarColumn(String fieldName) { @@ -55,26 +55,26 @@ public class StarColumnHelper { } public static String extractStarColumnPrefix(String fieldName) { - + assert (isPrefixedStarColumn(fieldName)); - - return fieldName.substring(0, fieldName.indexOf(PREFIXED_STAR_COLUMN)); + + return fieldName.substring(0, fieldName.indexOf(PREFIXED_STAR_COLUMN)); } - + public static String extractColumnPrefix(String fieldName) { - if (fieldName.indexOf(PREFIX_DELIMITER) >=0) { + if (fieldName.indexOf(PREFIX_DELIMITER) >=0) { return fieldName.substring(0, fieldName.indexOf(PREFIX_DELIMITER)); } else { return ""; } } - - // Given a set of prefixes, check if a regular column is subsumed by any of the prefixed star column in the set. + + // Given a set of prefixes, check if a regular column is subsumed by any of the prefixed star column in the set. public static boolean subsumeRegColumn(Set<String> prefixes, String fieldName) { if (isPrefixedStarColumn(fieldName)) return false; // only applies to regular column. - - return prefixes.contains(extractColumnPrefix(fieldName)); + + return prefixes.contains(extractColumnPrefix(fieldName)); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillAggregateRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillAggregateRelBase.java index 98f6bd5cd..c733f7755 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillAggregateRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillAggregateRelBase.java @@ -40,15 +40,15 @@ public abstract class DrillAggregateRelBase extends AggregateRelBase implements List<AggregateCall> aggCalls) throws InvalidRelException { super(cluster, traits, child, groupSet, aggCalls); } - + @Override public RelOptCost computeSelfCost(RelOptPlanner planner) { for (AggregateCall aggCall : getAggCallList()) { String name = aggCall.getAggregation().getName(); - // For avg, stddev_pop, stddev_samp, var_pop and var_samp, the ReduceAggregatesRule is supposed + // For avg, stddev_pop, stddev_samp, var_pop and var_samp, the ReduceAggregatesRule is supposed // to convert them to use sum and count. Here, we make the cost of the original functions high - // enough such that the planner does not choose them and instead chooses the rewritten functions. - if (name.equals("AVG") || name.equals("STDDEV_POP") || name.equals("STDDEV_SAMP") + // enough such that the planner does not choose them and instead chooses the rewritten functions. + if (name.equals("AVG") || name.equals("STDDEV_POP") || name.equals("STDDEV_SAMP") || name.equals("VAR_POP") || name.equals("VAR_SAMP")) { return ((DrillCostFactory)planner.getCostFactory()).makeHugeCost(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillFilterRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillFilterRelBase.java index 865c0fb07..f9b1e42c0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillFilterRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillFilterRelBase.java @@ -17,21 +17,13 @@ */ package org.apache.drill.exec.planner.common; -import java.util.List; - import org.apache.drill.common.expression.LogicalExpression; -import org.apache.drill.common.logical.data.Filter; -import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; -import org.apache.drill.exec.planner.logical.DrillImplementor; import org.apache.drill.exec.planner.logical.DrillOptiq; import org.apache.drill.exec.planner.logical.DrillParseContext; -import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.physical.PrelUtil; -import org.apache.drill.exec.planner.torel.ConversionContext; import org.eigenbase.rel.FilterRelBase; -import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.Convention; @@ -47,27 +39,27 @@ import org.eigenbase.rex.RexNode; */ public abstract class DrillFilterRelBase extends FilterRelBase implements DrillRelNode { int numConjuncts = 0; - + protected DrillFilterRelBase(Convention convention, RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) { super(cluster, traits, child, condition); assert getConvention() == convention; - - // save the number of conjuncts that make up the filter condition such + + // save the number of conjuncts that make up the filter condition such // that repeated calls to the costing function can use the saved copy numConjuncts = RelOptUtil.conjunctions(condition).size(); assert numConjuncts >= 1; } - + @Override public RelOptCost computeSelfCost(RelOptPlanner planner) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { - return super.computeSelfCost(planner).multiplyBy(.1); + return super.computeSelfCost(planner).multiplyBy(.1); } RelNode child = this.getChild(); double inputRows = RelMetadataQuery.getRowCount(child); double cpuCost = DrillCostBase.COMPARE_CPU_COST * numConjuncts * inputRows; DrillCostFactory costFactory = (DrillCostFactory)planner.getCostFactory(); - return costFactory.makeCost(inputRows, cpuCost, 0, 0); + return costFactory.makeCost(inputRows, cpuCost, 0, 0); } protected LogicalExpression getFilterExpression(DrillParseContext context){ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillLimitRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillLimitRelBase.java index ab6bc0275..11164fbd1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillLimitRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillLimitRelBase.java @@ -17,29 +17,18 @@ */ package org.apache.drill.exec.planner.common; -import java.math.BigDecimal; -import java.util.List; - -import org.apache.drill.common.logical.data.Limit; -import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; -import org.apache.drill.exec.planner.logical.DrillImplementor; -import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.physical.PrelUtil; -import org.apache.drill.exec.planner.torel.ConversionContext; -import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.RelWriter; import org.eigenbase.rel.SingleRel; -import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.rex.RexLiteral; import org.eigenbase.rex.RexNode; -import org.eigenbase.sql.type.SqlTypeName; /** * Base class for logical and physical Limits implemented in Drill @@ -57,30 +46,31 @@ public abstract class DrillLimitRelBase extends SingleRel implements DrillRelNod public RexNode getOffset() { return this.offset; } - + public RexNode getFetch() { return this.fetch; } - + @Override public RelOptCost computeSelfCost(RelOptPlanner planner) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { - return super.computeSelfCost(planner).multiplyBy(.1); + return super.computeSelfCost(planner).multiplyBy(.1); } - + int off = offset != null ? RexLiteral.intValue(offset) : 0 ; int f = fetch != null ? RexLiteral.intValue(fetch) : 0 ; double numRows = off + f; double cpuCost = DrillCostBase.COMPARE_CPU_COST * numRows; DrillCostFactory costFactory = (DrillCostFactory)planner.getCostFactory(); - return costFactory.makeCost(numRows, cpuCost, 0, 0); + return costFactory.makeCost(numRows, cpuCost, 0, 0); } - + + @Override public RelWriter explainTerms(RelWriter pw) { super.explainTerms(pw); pw.itemIf("offset", offset, offset != null); pw.itemIf("fetch", fetch, fetch != null); return pw; - } + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillProjectRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillProjectRelBase.java index 7658bb0b0..f440c29c4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillProjectRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillProjectRelBase.java @@ -74,24 +74,24 @@ public abstract class DrillProjectRelBase extends ProjectRelBase implements Dril // By default, the project will not allow duplicate columns, caused by expanding from * column. // For example, if we have T1_*, T1_Col1, T1_Col2, Col1 and Col2 will have two copies if we expand // * into a list of regular columns. For the intermediate project, the duplicate columns are not - // necessary; it will impact performance. + // necessary; it will impact performance. protected List<NamedExpression> getProjectExpressions(DrillParseContext context) { List<NamedExpression> expressions = Lists.newArrayList(); - + HashSet<String> starColPrefixes = new HashSet<String>(); - + // To remove duplicate columns caused by expanding from * column, we'll keep track of // all the prefix in the project expressions. If a regular column C1 have the same prefix, that - // regular column is not included in the project expression, since at execution time, * will be - // expanded into a list of column, including column C1. + // regular column is not included in the project expression, since at execution time, * will be + // expanded into a list of column, including column C1. for (String fieldName : getRowType().getFieldNames()) { if (StarColumnHelper.isPrefixedStarColumn(fieldName)) { starColPrefixes.add(StarColumnHelper.extractStarColumnPrefix(fieldName)); } } - + for (Pair<RexNode, String> pair : projects()) { - if (! StarColumnHelper.subsumeRegColumn(starColPrefixes, pair.right)) { + if (! StarColumnHelper.subsumeRegColumn(starColPrefixes, pair.right)) { LogicalExpression expr = DrillOptiq.toDrill(context, getChild(), pair.left); expressions.add(new NamedExpression(expr, FieldReference.getWithQuotedRef(pair.right))); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillRelOptUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillRelOptUtil.java index 58dc34d43..270462b2d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillRelOptUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillRelOptUtil.java @@ -25,7 +25,7 @@ import org.eigenbase.sql.type.SqlTypeName; import org.eigenbase.util.Pair; /** - * Utility class that is a subset of the RelOptUtil class and is a placeholder for Drill specific + * Utility class that is a subset of the RelOptUtil class and is a placeholder for Drill specific * static methods that are needed during either logical or physical planning. */ public abstract class DrillRelOptUtil { @@ -34,7 +34,7 @@ public abstract class DrillRelOptUtil { public static boolean areRowTypesEqual( RelDataType rowType1, RelDataType rowType2, - boolean compareNames, + boolean compareNames, boolean allowSubstring) { if (rowType1 == rowType2) { return true; @@ -58,11 +58,11 @@ public abstract class DrillRelOptUtil { continue; } if (!type1.equals(type2)) { - if (allowSubstring - && (type1.getSqlTypeName() == SqlTypeName.CHAR && type2.getSqlTypeName() == SqlTypeName.CHAR) + if (allowSubstring + && (type1.getSqlTypeName() == SqlTypeName.CHAR && type2.getSqlTypeName() == SqlTypeName.CHAR) && (type1.getPrecision() <= type2.getPrecision())) { return true; - } + } return false; } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScanRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScanRelBase.java index 331069d03..093481804 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScanRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScanRelBase.java @@ -25,8 +25,8 @@ import org.eigenbase.relopt.RelOptTable; import org.eigenbase.relopt.RelTraitSet; /** - * Base class for logical scan rel implemented in Drill. - * NOTE: we should eventually make this class independent of TableAccessRelBase and then + * Base class for logical scan rel implemented in Drill. + * NOTE: we should eventually make this class independent of TableAccessRelBase and then * make it the base class for logical and physical scan rels. */ public abstract class DrillScanRelBase extends TableAccessRelBase implements DrillRelNode { @@ -37,5 +37,5 @@ public abstract class DrillScanRelBase extends TableAccessRelBase implements Dri this.drillTable = table.unwrap(DrillTable.class); assert drillTable != null; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScreenRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScreenRelBase.java index 23b53f37c..9b31fb0c2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScreenRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillScreenRelBase.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.planner.common; -import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.planner.physical.PrelUtil; import org.eigenbase.rel.RelNode; @@ -42,7 +41,7 @@ public abstract class DrillScreenRelBase extends SingleRel implements DrillRelNo @Override public RelOptCost computeSelfCost(RelOptPlanner planner) { if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) { - return super.computeSelfCost(planner).multiplyBy(.1); + return super.computeSelfCost(planner).multiplyBy(.1); } // by default, assume cost is proportional to number of rows double rowCount = RelMetadataQuery.getRowCount(this); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java index c6e3ae14b..adf7d6bff 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillStoreRelBase.java @@ -36,7 +36,7 @@ public abstract class DrillStoreRelBase extends TableModificationRelBase impleme protected DrillStoreRelBase(RelOptCluster cluster, RelTraitSet traits, RelOptTable table, CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super(cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillUnionRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillUnionRelBase.java index fa0465f09..127798f20 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillUnionRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillUnionRelBase.java @@ -23,18 +23,14 @@ import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.UnionRelBase; import org.eigenbase.relopt.RelOptCluster; -import org.eigenbase.relopt.RelOptUtil; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.reltype.RelDataType; -import org.eigenbase.reltype.RelDataTypeField; -import org.eigenbase.sql.type.SqlTypeName; -import org.eigenbase.util.Pair; /** * Base class for logical and physical Union implemented in Drill */ public abstract class DrillUnionRelBase extends UnionRelBase implements DrillRelNode { - + public DrillUnionRelBase(RelOptCluster cluster, RelTraitSet traits, List<RelNode> inputs, boolean all) throws InvalidRelException { super(cluster, traits, inputs, all); @@ -43,7 +39,7 @@ public abstract class DrillUnionRelBase extends UnionRelBase implements DrillRel throw new InvalidRelException("Input row types of the Union are not compatible."); } } - + public boolean isCompatible(boolean compareNames, boolean allowSubstring) { RelDataType unionType = getRowType(); for (RelNode input : getInputs()) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillCostBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillCostBase.java index 50e4fb6a1..c33bb22ce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillCostBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillCostBase.java @@ -29,12 +29,12 @@ public class DrillCostBase implements DrillRelOptCost { /** * NOTE: the multiplication factors below are not calibrated yet...these - * are chosen based on approximations for now. For reference purposes, - * assume each disk on a server can have a sustained I/O throughput of + * are chosen based on approximations for now. For reference purposes, + * assume each disk on a server can have a sustained I/O throughput of * 100 MBytes/sec. Suppose there is an array of 16 disks per server..theoretically - * one could get 1.6GBytes/sec. Suppose network speed is 1GBit/sec which is + * one could get 1.6GBytes/sec. Suppose network speed is 1GBit/sec which is * 128MBytes/sec, although actual transfer rate over the network may be lower. - * We are only concerned with relative costs, not absolute values. + * We are only concerned with relative costs, not absolute values. * For relative costing, let's assume sending data over the network is * about 16x slower than reading/writing to an array of local disks. */ @@ -47,48 +47,50 @@ public class DrillCostBase implements DrillRelOptCost { public static final int FUNC_CPU_COST = 12 * BASE_CPU_COST; // cpu cost for a function evaluation // cpu cost for projecting an expression; note that projecting an expression - // that is not a simple column or constant may include evaluation, but we - // currently don't model it at that level of detail. - public static final int PROJECT_CPU_COST = 4 * BASE_CPU_COST; + // that is not a simple column or constant may include evaluation, but we + // currently don't model it at that level of detail. + public static final int PROJECT_CPU_COST = 4 * BASE_CPU_COST; - // hash cpu cost per field (for now we don't distinguish between fields of different types) involves - // the cost of the following operations: + // hash cpu cost per field (for now we don't distinguish between fields of different types) involves + // the cost of the following operations: // compute hash value, probe hash table, walk hash chain and compare with each element, // add to the end of hash chain if no match found - public static final int HASH_CPU_COST = 8 * BASE_CPU_COST; - + public static final int HASH_CPU_COST = 8 * BASE_CPU_COST; + public static final int RANGE_PARTITION_CPU_COST = 12 * BASE_CPU_COST; - - // cost of comparing one field with another (ignoring data types for now) - public static final int COMPARE_CPU_COST = 4 * BASE_CPU_COST; + + // cost of comparing one field with another (ignoring data types for now) + public static final int COMPARE_CPU_COST = 4 * BASE_CPU_COST; public static final int AVG_FIELD_WIDTH = 8; - - /** For the costing formulas in computeSelfCost(), assume the following notations: - * Let - * C = Cost per node. + + /** For the costing formulas in computeSelfCost(), assume the following notations: + * Let + * C = Cost per node. * k = number of fields on which to distribute on - * h = CPU cost of computing hash value on 1 field + * h = CPU cost of computing hash value on 1 field * s = CPU cost of Selection-Vector remover per row * w = Network cost of sending 1 row to 1 destination * c = CPU cost of comparing an incoming row with one on a heap of size N */ - + static final DrillCostBase INFINITY = new DrillCostBase( Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, - Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) { + @Override public String toString() { return "{inf}"; } }; static final DrillCostBase HUGE = - new DrillCostBase(Double.MAX_VALUE, - Double.MAX_VALUE, - Double.MAX_VALUE, + new DrillCostBase(Double.MAX_VALUE, + Double.MAX_VALUE, + Double.MAX_VALUE, Double.MAX_VALUE) { + @Override public String toString() { return "{huge}"; } @@ -96,6 +98,7 @@ public class DrillCostBase implements DrillRelOptCost { static final DrillCostBase ZERO = new DrillCostBase(0.0, 0.0, 0.0, 0.0) { + @Override public String toString() { return "{0}"; } @@ -103,6 +106,7 @@ public class DrillCostBase implements DrillRelOptCost { static final DrillCostBase TINY = new DrillCostBase(1.0, 1.0, 0.0, 0.0) { + @Override public String toString() { return "{tiny}"; } @@ -160,7 +164,7 @@ public class DrillCostBase implements DrillRelOptCost { return (this == INFINITY) || (this.cpu == Double.POSITIVE_INFINITY) || (this.io == Double.POSITIVE_INFINITY) - || (this.network == Double.POSITIVE_INFINITY) + || (this.network == Double.POSITIVE_INFINITY) || (this.rowCount == Double.POSITIVE_INFINITY); } @@ -168,8 +172,8 @@ public class DrillCostBase implements DrillRelOptCost { public boolean equals(RelOptCost other) { // here we compare the individual components similar to VolcanoCost, however // an alternative would be to add up the components and compare the total. - // Note that VolcanoPlanner mainly uses isLe() and isLt() for cost comparisons, - // not equals(). + // Note that VolcanoPlanner mainly uses isLe() and isLt() for cost comparisons, + // not equals(). return this == other || (other instanceof DrillCostBase && (this.cpu == ((DrillCostBase) other).cpu) @@ -184,20 +188,20 @@ public class DrillCostBase implements DrillRelOptCost { return false; } DrillCostBase that = (DrillCostBase) other; - return (this == that) + return (this == that) || ((Math.abs(this.cpu - that.cpu) < RelOptUtil.EPSILON) && (Math.abs(this.io - that.io) < RelOptUtil.EPSILON) && (Math.abs(this.network - that.network) < RelOptUtil.EPSILON) && (Math.abs(this.rowCount - that.rowCount) < RelOptUtil.EPSILON)); } - + @Override public boolean isLe(RelOptCost other) { DrillCostBase that = (DrillCostBase) other; - - return this == that + + return this == that || ( (this.cpu + this.io + this.network) <= - (that.cpu + that.io + that.network) + (that.cpu + that.io + that.network) && this.rowCount <= that.rowCount ); } @@ -206,12 +210,12 @@ public class DrillCostBase implements DrillRelOptCost { public boolean isLt(RelOptCost other) { DrillCostBase that = (DrillCostBase) other; - return ( (this.cpu + this.io + this.network) < - (that.cpu + that.io + that.network) + return ( (this.cpu + this.io + this.network) < + (that.cpu + that.io + that.network) && this.rowCount <= that.rowCount ); } - + @Override public RelOptCost plus(RelOptCost other) { DrillCostBase that = (DrillCostBase) other; @@ -290,10 +294,11 @@ public class DrillCostBase implements DrillRelOptCost { return Math.pow(d, 1 / n); } + @Override public String toString() { return "{" + rowCount + " rows, " + cpu + " cpu, " + io + " io, " + network + " network, " + memory + " memory}"; } - + public static class DrillCostFactory implements DrillRelOptCostFactory { public RelOptCost makeCost(double dRows, double dCpu, double dIo, double dNetwork, double dMemory) { @@ -303,11 +308,11 @@ public class DrillCostBase implements DrillRelOptCost { public RelOptCost makeCost(double dRows, double dCpu, double dIo, double dNetwork) { return new DrillCostBase(dRows, dCpu, dIo, dNetwork, 0); } - + public RelOptCost makeCost(double dRows, double dCpu, double dIo) { return new DrillCostBase(dRows, dCpu, dIo, 0, 0); } - + public RelOptCost makeHugeCost() { return DrillCostBase.HUGE; } @@ -323,6 +328,6 @@ public class DrillCostBase implements DrillRelOptCost { public RelOptCost makeZeroCost() { return DrillCostBase.ZERO; } - } - + } + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelOptCost.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelOptCost.java index 8f206585d..88e4e28bf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelOptCost.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelOptCost.java @@ -21,7 +21,7 @@ package org.apache.drill.exec.planner.cost; import org.eigenbase.relopt.RelOptCost; public interface DrillRelOptCost extends RelOptCost { - + double getNetwork(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/Fragment.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/Fragment.java index 5454e8f10..47d6f140b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/Fragment.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/Fragment.java @@ -23,30 +23,29 @@ import java.util.List; import org.apache.drill.exec.exception.FragmentSetupException; import org.apache.drill.exec.physical.base.Exchange; import org.apache.drill.exec.physical.base.PhysicalOperator; -import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import com.google.common.collect.Lists; public class Fragment implements Iterable<Fragment.ExchangeFragmentPair>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Fragment.class); - + private PhysicalOperator root; private Exchange sendingExchange; private final List<ExchangeFragmentPair> receivingExchangePairs = Lists.newLinkedList(); private Stats stats = new Stats(); - + public void addOperator(PhysicalOperator o){ if(root == null){ root = o; } } - + public void addSendExchange(Exchange e) throws FragmentSetupException{ if(sendingExchange != null) throw new FragmentSetupException("Fragment was trying to add a second SendExchange. "); addOperator(e); sendingExchange = e; } - + public void addReceiveExchange(Exchange e, Fragment fragment){ this.receivingExchangePairs.add(new ExchangeFragmentPair(e, fragment)); } @@ -71,11 +70,11 @@ public class Fragment implements Iterable<Fragment.ExchangeFragmentPair>{ // public <T, V> T accept(FragmentVisitor<T, V> visitor, V extra){ // return visitor.visit(this, extra); // } - + public Stats getStats(){ return stats; } - + public class ExchangeFragmentPair { private Exchange exchange; private Fragment node; @@ -102,9 +101,9 @@ public class Fragment implements Iterable<Fragment.ExchangeFragmentPair>{ public String toString() { return "ExchangeFragmentPair [exchange=" + exchange + "]"; } - - - + + + } @Override @@ -145,6 +144,6 @@ public class Fragment implements Iterable<Fragment.ExchangeFragmentPair>{ + receivingExchangePairs + ", stats=" + stats + "]"; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/MakeFragmentsVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/MakeFragmentsVisitor.java index 58a564620..690fe4582 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/MakeFragmentsVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/MakeFragmentsVisitor.java @@ -29,10 +29,10 @@ import org.apache.drill.exec.physical.base.SubScan; public class MakeFragmentsVisitor extends AbstractPhysicalVisitor<Fragment, Fragment, FragmentSetupException> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MakeFragmentsVisitor.class); - + public MakeFragmentsVisitor(){ } - + @Override public Fragment visitExchange(Exchange exchange, Fragment value) throws FragmentSetupException { // logger.debug("Visiting Exchange {}", exchange); @@ -60,7 +60,7 @@ public class MakeFragmentsVisitor extends AbstractPhysicalVisitor<Fragment, Frag } return value; } - + private Fragment ensureBuilder(Fragment value) throws FragmentSetupException{ if(value != null){ return value; @@ -68,7 +68,7 @@ public class MakeFragmentsVisitor extends AbstractPhysicalVisitor<Fragment, Frag return getNextBuilder(); } } - + public Fragment getNextBuilder(){ return new Fragment(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/PlanningSet.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/PlanningSet.java index da4380f3e..8cc6c855a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/PlanningSet.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/fragment/PlanningSet.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.planner.fragment; import java.util.Iterator; import java.util.Map; -import org.apache.drill.exec.ops.QueryContext; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import com.google.common.collect.Maps; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/CreateTableEntry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/CreateTableEntry.java index 7f6acd9ff..673e8c645 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/CreateTableEntry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/CreateTableEntry.java @@ -18,13 +18,14 @@ package org.apache.drill.exec.planner.logical; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; -import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.io.IOException; + import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.Writer; -import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo; /** * Interface that provides the info needed to create a new table. A storage engine diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillAggregateRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillAggregateRel.java index fe5130ced..e31aaa7c6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillAggregateRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillAggregateRel.java @@ -51,6 +51,7 @@ public class DrillAggregateRel extends DrillAggregateRelBase implements DrillRel super(cluster, traits, child, groupSet, aggCalls); } + @Override public AggregateRelBase copy(RelTraitSet traitSet, RelNode input, BitSet groupSet, List<AggregateCall> aggCalls) { try { return new DrillAggregateRel(getCluster(), traitSet, input, getGroupSet(), aggCalls); @@ -71,31 +72,31 @@ public class DrillAggregateRel extends DrillAggregateRelBase implements DrillRel FieldReference fr = new FieldReference(childFields.get(group), ExpressionPosition.UNKNOWN); builder.addKey(fr, fr); } - + for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) { FieldReference ref = new FieldReference(fields.get(groupSet.cardinality() + aggCall.i)); LogicalExpression expr = toDrill(aggCall.e, childFields, implementor); builder.addExpr(ref, expr); } - + return builder.build(); } - - - + + + private LogicalExpression toDrill(AggregateCall call, List<String> fn, DrillImplementor implementor) { List<LogicalExpression> args = Lists.newArrayList(); for(Integer i : call.getArgList()){ args.add(new FieldReference(fn.get(i))); } - + // for count(1). if(args.isEmpty()) args.add(new ValueExpressions.LongExpression(1l)); LogicalExpression expr = FunctionCallFactory.createExpression(call.getAggregation().getName().toLowerCase(), ExpressionPosition.UNKNOWN, args); return expr; } - + public static DrillAggregateRel convert(GroupingAggregate groupBy, ConversionContext value) throws InvalidRelException { throw new UnsupportedOperationException(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRel.java index fee62c9f8..63bef4428 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRel.java @@ -47,7 +47,7 @@ public class DrillFilterRel extends DrillFilterRelBase implements DrillRel { f.setInput(input); return f; } - + public static DrillFilterRel convert(Filter filter, ConversionContext context) throws InvalidRelException{ RelNode input = context.toRel(filter.getInput()); return new DrillFilterRel(context.getCluster(), context.getLogicalTraits(), input, context.toRex(filter.getExpr())); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRule.java index 8f18838d0..cb47adb08 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillFilterRule.java @@ -22,7 +22,6 @@ import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.Convention; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; -import org.eigenbase.relopt.RelTraitSet; /** * Rule that converts a {@link org.eigenbase.rel.FilterRel} to a Drill "filter" operation. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillImplementor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillImplementor.java index 6a7c8e4f3..7fff6e9b6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillImplementor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillImplementor.java @@ -33,21 +33,21 @@ import com.google.common.collect.Sets; * Context for converting a tree of {@link DrillRel} nodes into a Drill logical plan. */ public class DrillImplementor { - + static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillImplementor.class); - + private Set<DrillTable> tables = Sets.newHashSet(); private Set<String> storageEngineNames = Sets.newHashSet(); private LogicalPlanBuilder planBuilder = new LogicalPlanBuilder(); private LogicalPlan plan; private final DrillParseContext context; - - + + public DrillImplementor(DrillParseContext context, ResultMode mode) { planBuilder.planProperties(PlanType.APACHE_DRILL_LOGICAL, 1, DrillImplementor.class.getName(), "", mode); this.context = context; } - + public DrillParseContext getContext(){ return context; } @@ -62,7 +62,7 @@ public class DrillImplementor { LogicalOperator rootLOP = root.implement(this); rootLOP.accept(new AddOpsVisitor(), null); } - + public LogicalPlan getPlan(){ if(plan == null){ plan = planBuilder.build(); @@ -74,7 +74,7 @@ public class DrillImplementor { public LogicalOperator visitChild(DrillRel parent, int ordinal, RelNode child) { return ((DrillRel) child).implement(this); } - + private class AddOpsVisitor extends AbstractLogicalVisitor<Void, Void, RuntimeException> { @Override public Void visitOp(LogicalOperator op, Void value) throws RuntimeException { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java index 151318e2a..8d3e1bf86 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillJoinRel.java @@ -18,8 +18,6 @@ package org.apache.drill.exec.planner.logical; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; import java.util.List; import org.apache.drill.common.expression.FieldReference; @@ -30,13 +28,11 @@ import org.apache.drill.common.logical.data.Project; import org.apache.drill.exec.planner.common.DrillJoinRelBase; import org.apache.drill.exec.planner.torel.ConversionContext; import org.eigenbase.rel.InvalidRelException; -import org.eigenbase.rel.JoinRelBase; import org.eigenbase.rel.JoinRelType; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptUtil; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeField; import org.eigenbase.rex.RexNode; import org.eigenbase.rex.RexUtil; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillLimitRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillLimitRel.java index 9f08117e4..75a38d88e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillLimitRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillLimitRel.java @@ -23,8 +23,6 @@ import java.util.List; import org.apache.drill.common.logical.data.Limit; import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.exec.planner.common.DrillLimitRelBase; -import org.apache.drill.exec.planner.logical.DrillImplementor; -import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.torel.ConversionContext; import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; @@ -48,7 +46,7 @@ public class DrillLimitRel extends DrillLimitRelBase implements DrillRel { @Override public LogicalOperator implement(DrillImplementor implementor) { LogicalOperator inputOp = implementor.visitChild(this, 0, getChild()); - + // First offset to include into results (inclusive). Null implies it is starting from offset 0 int first = offset != null ? Math.max(0, RexLiteral.intValue(offset)) : 0; @@ -59,7 +57,7 @@ public class DrillLimitRel extends DrillLimitRelBase implements DrillRel { limit.setInput(inputOp); return limit; } - + public static DrillLimitRel convert(Limit limit, ConversionContext context) throws InvalidRelException{ RelNode input = context.toRel(limit.getInput()); RexNode first = context.getRexBuilder().makeExactLiteral(BigDecimal.valueOf(limit.getFirst()), context.getTypeFactory().createSqlType(SqlTypeName.INTEGER)); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillMergeProjectRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillMergeProjectRule.java index 7abc28bda..b97d83e3a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillMergeProjectRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillMergeProjectRule.java @@ -18,17 +18,14 @@ package org.apache.drill.exec.planner.logical; +import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.eigenbase.rel.ProjectRelBase; import org.eigenbase.rel.RelFactories.ProjectFactory; - import org.eigenbase.rel.rules.MergeProjectRule; import org.eigenbase.relopt.RelOptRuleCall; - import org.eigenbase.rex.RexCall; import org.eigenbase.rex.RexNode; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; - public class DrillMergeProjectRule extends MergeProjectRule { private FunctionImplementationRegistry functionRegistry; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java index 891b88957..0627dcdc0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java @@ -32,8 +32,8 @@ import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.expression.TypedNullConstant; import org.apache.drill.common.expression.ValueExpressions; import org.apache.drill.common.expression.ValueExpressions.QuotedString; -import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; import org.apache.drill.exec.planner.StarColumnHelper; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillProjectRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillProjectRel.java index c3eb3fba5..14ea8947a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillProjectRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillProjectRel.java @@ -48,6 +48,7 @@ public class DrillProjectRel extends DrillProjectRelBase implements DrillRel { } + @Override public ProjectRelBase copy(RelTraitSet traitSet, RelNode input, List<RexNode> exps, RelDataType rowType) { return new DrillProjectRel(getCluster(), traitSet, input, exps, rowType); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java index 8305dd8a6..93fff3587 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java @@ -39,7 +39,6 @@ import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeFactory; import org.eigenbase.reltype.RelDataTypeField; import org.eigenbase.rex.RexBuilder; -import org.eigenbase.rex.RexCall; import org.eigenbase.rex.RexLiteral; import org.eigenbase.rex.RexNode; import org.eigenbase.sql.SqlAggFunction; @@ -86,6 +85,7 @@ public class DrillReduceAggregatesRule extends RelOptRule { return containsAvgStddevVarCall(oldAggRel.getAggCallList()); } + @Override public void onMatch(RelOptRuleCall ruleCall) { AggregateRelBase oldAggRel = (AggregateRelBase) ruleCall.rels[0]; reduceAggs(ruleCall, oldAggRel); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java index 65fa2d7d1..dbb85b22d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillRuleSets.java @@ -44,7 +44,6 @@ import org.eigenbase.rel.RelFactories; import org.eigenbase.rel.rules.PushFilterPastJoinRule; import org.eigenbase.rel.rules.PushFilterPastProjectRule; import org.eigenbase.rel.rules.PushJoinThroughJoinRule; -import org.eigenbase.rel.rules.PushProjectPastFilterRule; import org.eigenbase.rel.rules.PushProjectPastJoinRule; import org.eigenbase.rel.rules.RemoveDistinctAggregateRule; import org.eigenbase.rel.rules.RemoveDistinctRule; @@ -113,7 +112,7 @@ public class DrillRuleSets { return DRILL_BASIC_RULES; } - /* + /* public static final RuleSet DRILL_PHYSICAL_MEM = new DrillRuleSet(ImmutableSet.of( // // DrillScanRule.INSTANCE, // DrillFilterRule.INSTANCE, @@ -169,9 +168,9 @@ public class DrillRuleSets { )); public static final RuleSet getPhysicalRules(QueryContext qcontext) { - List<RelOptRule> ruleList = new ArrayList<RelOptRule>(); + List<RelOptRule> ruleList = new ArrayList<RelOptRule>(); + - ruleList.add(ConvertCountToDirectScan.AGG_ON_PROJ_ON_SCAN); ruleList.add(ConvertCountToDirectScan.AGG_ON_SCAN); ruleList.add(SortConvertPrule.INSTANCE); @@ -186,26 +185,26 @@ public class DrillRuleSets { ruleList.add(PushLimitToTopN.INSTANCE); ruleList.add(UnionAllPrule.INSTANCE); // ruleList.add(UnionDistinctPrule.INSTANCE); - + PlannerSettings ps = qcontext.getPlannerSettings(); - + if (ps.isHashAggEnabled()) { - ruleList.add(HashAggPrule.INSTANCE); + ruleList.add(HashAggPrule.INSTANCE); } - + if (ps.isStreamAggEnabled()) { - ruleList.add(StreamAggPrule.INSTANCE); + ruleList.add(StreamAggPrule.INSTANCE); } - + if (ps.isHashJoinEnabled()) { - ruleList.add(HashJoinPrule.INSTANCE); + ruleList.add(HashJoinPrule.INSTANCE); } - + if (ps.isMergeJoinEnabled()) { - ruleList.add(MergeJoinPrule.INSTANCE); + ruleList.add(MergeJoinPrule.INSTANCE); } - - return new DrillRuleSet(ImmutableSet.copyOf(ruleList)); + + return new DrillRuleSet(ImmutableSet.copyOf(ruleList)); } public static RuleSet create(ImmutableSet<RelOptRule> rules) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java index d6bbcd3e8..5a0cc08b0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRel.java @@ -18,21 +18,15 @@ package org.apache.drill.exec.planner.logical; import java.io.IOException; -import java.util.Collections; import java.util.List; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; import org.apache.drill.common.JSONOptions; import org.apache.drill.common.exceptions.DrillRuntimeException; -import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.common.logical.data.Scan; import org.apache.drill.exec.physical.base.AbstractGroupScan; import org.apache.drill.exec.physical.base.GroupScan; -import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.ScanStats; import org.apache.drill.exec.planner.common.DrillScanRelBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; @@ -46,6 +40,10 @@ import org.eigenbase.relopt.RelOptTable; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.reltype.RelDataType; +import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + /** * GroupScan of a Drill table. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRule.java index 4896ac90d..d71019aff 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScanRule.java @@ -19,8 +19,6 @@ package org.apache.drill.exec.planner.logical; import net.hydromatic.optiq.rules.java.JavaRules.EnumerableTableAccessRel; -import org.apache.drill.exec.planner.common.DrillScanRelBase; -import org.eigenbase.relopt.Convention; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.relopt.RelTraitSet; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScreenRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScreenRel.java index a63cae047..28f4205a2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScreenRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillScreenRel.java @@ -39,7 +39,7 @@ public class DrillScreenRel extends DrillScreenRelBase implements DrillRel { public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new DrillScreenRel(getCluster(), traitSet, sole(inputs)); } - + @Override public LogicalOperator implement(DrillImplementor implementor) { LogicalOperator childOp = implementor.visitChild(this, 0, getChild()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSortRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSortRel.java index 04af9d5b4..830f5f24d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSortRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillSortRel.java @@ -62,19 +62,19 @@ public class DrillSortRel extends SortRel implements DrillRel { public LogicalOperator implement(DrillImplementor implementor) { final Order.Builder builder = Order.builder(); builder.setInput(implementor.visitChild(this, 0, getChild())); - + final List<String> childFields = getChild().getRowType().getFieldNames(); for(RelFieldCollation fieldCollation : this.collation.getFieldCollations()){ - builder.addOrdering(fieldCollation.getDirection(), + builder.addOrdering(fieldCollation.getDirection(), new FieldReference(childFields.get(fieldCollation.getFieldIndex())), fieldCollation.nullDirection); } return builder.build(); } - + public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException{ - + // if there are compound expressions in the order by, we need to convert into projects on either side. RelNode input = context.toRel(order.getInput()); List<String> fields = input.getRowType().getFieldNames(); @@ -86,9 +86,9 @@ public class DrillSortRel extends SortRel implements DrillRel { fieldMap.put(field, i); i++; } - + List<RelFieldCollation> collations = Lists.newArrayList(); - + for(Ordering o : order.getOrderings()){ String fieldName = ExprHelper.getFieldName(o.getExpr()); int fieldId = fieldMap.get(fieldName); @@ -96,5 +96,5 @@ public class DrillSortRel extends SortRel implements DrillRel { } return new DrillSortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollationImpl.of(collations)); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java index 830c34b09..6295eaba9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillStoreRel.java @@ -23,8 +23,6 @@ import net.hydromatic.optiq.prepare.Prepare.CatalogReader; import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.exec.planner.common.DrillStoreRelBase; -import org.apache.drill.exec.planner.logical.DrillImplementor; -import org.apache.drill.exec.planner.logical.DrillRel; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptTable; @@ -36,7 +34,7 @@ public class DrillStoreRel extends DrillStoreRelBase implements DrillRel{ protected DrillStoreRel(RelOptCluster cluster, RelTraitSet traits, RelOptTable table, CatalogReader catalogReader, RelNode child, Operation operation, List<String> updateColumnList, boolean flattened) { super(cluster, traits, table, catalogReader, child, operation, updateColumnList, flattened); - + } @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillTable.java index 8e6b914e2..2e7f9f2f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillTable.java @@ -33,18 +33,18 @@ import org.eigenbase.relopt.RelOptTable; public abstract class DrillTable implements Table{ - - private final String storageEngineName; + + private final String storageEngineName; public final StoragePluginConfig storageEngineConfig; private Object selection; private StoragePlugin plugin; - private GroupScan scan; - + private GroupScan scan; + /** Creates a DrillTable. */ public DrillTable(String storageEngineName, StoragePlugin plugin, Object selection) { this.selection = selection; this.plugin = plugin; - + this.storageEngineConfig = plugin.getConfig(); this.storageEngineName = storageEngineName; } @@ -55,19 +55,19 @@ public abstract class DrillTable implements Table{ } return scan; } - + public StoragePluginConfig getStorageEngineConfig(){ return storageEngineConfig; } - + public StoragePlugin getPlugin(){ return plugin; } - + public Object getSelection() { return selection; } - + public String getStorageEngineName() { return storageEngineName; } @@ -125,6 +125,6 @@ public abstract class DrillTable implements Table{ return true; } - - + + }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java index fdf43dd93..1fa70010e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRel.java @@ -24,7 +24,6 @@ import net.hydromatic.linq4j.Ord; import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.common.logical.data.Union; import org.apache.drill.exec.planner.common.DrillUnionRelBase; -import org.apache.drill.exec.planner.logical.DrillImplementor; import org.apache.drill.exec.planner.torel.ConversionContext; import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; @@ -46,7 +45,7 @@ public class DrillUnionRel extends DrillUnionRelBase implements DrillRel { @Override public DrillUnionRel copy(RelTraitSet traitSet, List<RelNode> inputs, boolean all) { - try { + try { return new DrillUnionRel(getCluster(), traitSet, inputs, all); } catch (InvalidRelException e) { throw new AssertionError(e) ; @@ -68,7 +67,7 @@ public class DrillUnionRel extends DrillUnionRelBase implements DrillRel { builder.setDistinct(!all); return builder.build(); } - + public static DrillUnionRel convert(Union union, ConversionContext context) throws InvalidRelException{ throw new UnsupportedOperationException(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java index 86ced35e8..93a039135 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillUnionRule.java @@ -51,7 +51,7 @@ public class DrillUnionRule extends RelOptRule { final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL)); convertedInputs.add(convertedInput); } - try { + try { call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all)); } catch (InvalidRelException e) { tracer.warning(e.toString()) ; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DynamicDrillTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DynamicDrillTable.java index e7ff266a0..843db580d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DynamicDrillTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DynamicDrillTable.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.planner.logical; -import org.apache.drill.common.logical.StoragePluginConfig; import org.apache.drill.exec.planner.types.RelDataTypeDrillImpl; import org.apache.drill.exec.planner.types.RelDataTypeHolder; import org.apache.drill.exec.store.StoragePlugin; @@ -28,7 +27,7 @@ public class DynamicDrillTable extends DrillTable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DynamicDrillTable.class); private RelDataTypeHolder holder = new RelDataTypeHolder(); - + public DynamicDrillTable(StoragePlugin plugin, String storageEngineName, Object selection) { super(storageEngineName, plugin, selection); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/EnumerableDrillRule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/EnumerableDrillRule.java index efc29f46e..131c60fbb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/EnumerableDrillRule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/EnumerableDrillRule.java @@ -29,8 +29,8 @@ import org.eigenbase.rel.convert.ConverterRule; public class EnumerableDrillRule extends ConverterRule { public static EnumerableDrillRule INSTANCE = new EnumerableDrillRule(); - - + + private EnumerableDrillRule() { super(RelNode.class, DrillRel.DRILL_LOGICAL, EnumerableConvention.INSTANCE, "EnumerableDrillRule."); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ExprHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ExprHelper.java index 128ba286f..d4321bcbe 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ExprHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ExprHelper.java @@ -21,7 +21,6 @@ import java.util.List; import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.common.expression.LogicalExpression; -import org.apache.drill.common.expression.SchemaPath; public class ExprHelper { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExprHelper.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java index 88d17a398..67848882f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/FileSystemCreateTableEntry.java @@ -17,10 +17,8 @@ */ package org.apache.drill.exec.planner.logical; -import com.fasterxml.jackson.annotation.JacksonInject; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.logical.FormatPluginConfig; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -29,7 +27,10 @@ import org.apache.drill.exec.store.StoragePluginRegistry; import org.apache.drill.exec.store.dfs.FileSystemConfig; import org.apache.drill.exec.store.dfs.FormatPlugin; -import java.io.IOException; +import com.fasterxml.jackson.annotation.JacksonInject; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; /** * Implements <code>CreateTableEntry</code> interface to create new tables in FileSystem storage. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RelOptHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RelOptHelper.java index 2e253aba7..172ee2a21 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RelOptHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RelOptHelper.java @@ -24,7 +24,7 @@ import org.eigenbase.relopt.RelTrait; public class RelOptHelper { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RelOptHelper.class); - + public static RelOptRuleOperand any(Class<? extends RelNode> first, RelTrait trait){ return RelOptRule.operand(first, trait, RelOptRule.any()); } @@ -36,7 +36,7 @@ public class RelOptHelper { public static RelOptRuleOperand any(Class<? extends RelNode> first, Class<? extends RelNode> second) { return RelOptRule.operand(first, RelOptRule.operand(second, RelOptRule.any())); } - + public static RelOptRuleOperand some(Class<? extends RelNode> rel, RelOptRuleOperand first, RelOptRuleOperand... rest){ return RelOptRule.operand(rel, RelOptRule.some(first, rest)); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RewriteProjectRel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RewriteProjectRel.java index 0e4c71dd7..f0ff70cee 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RewriteProjectRel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/RewriteProjectRel.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.planner.logical; +import java.util.ArrayList; +import java.util.List; + import org.apache.drill.exec.planner.sql.DrillOperatorTable; import org.eigenbase.rel.ProjectRel; import org.eigenbase.rel.RelNode; @@ -30,9 +33,6 @@ import org.eigenbase.sql.SqlFunction; import org.eigenbase.sql.SqlOperator; import org.eigenbase.util.NlsString; -import java.util.ArrayList; -import java.util.List; - /** * This class rewrites all the project expression that contain convert_to/ convert_from * to actual implementations. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ScanFieldDeterminer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ScanFieldDeterminer.java index 980977085..59c65f90e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ScanFieldDeterminer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/ScanFieldDeterminer.java @@ -56,7 +56,7 @@ public class ScanFieldDeterminer extends AbstractLogicalVisitor<Void, ScanFieldD private FieldReferenceFinder finder = new FieldReferenceFinder(); private Map<Scan, FieldList> scanFields = Maps.newHashMap(); - + public static Map<Scan, FieldList> getFieldLists(LogicalPlan plan){ Collection<SinkOperator> ops = plan.getGraph().getRoots(); Preconditions.checkArgument(ops.size() == 1, "Scan Field determiner currently only works with plans that have a single root."); @@ -64,10 +64,10 @@ public class ScanFieldDeterminer extends AbstractLogicalVisitor<Void, ScanFieldD ops.iterator().next().accept(sfd, new FieldList()); return sfd.scanFields; } - + private ScanFieldDeterminer(){ } - + public static class FieldList { private Set<SchemaPath> projected = Sets.newHashSet(); private Set<SchemaPath> referenced = Sets.newHashSet(); @@ -88,6 +88,7 @@ public class ScanFieldDeterminer extends AbstractLogicalVisitor<Void, ScanFieldD projected.addAll(paths); } + @Override public FieldList clone() { FieldList newList = new FieldList(); for (SchemaPath p : projected) { @@ -166,7 +167,7 @@ public class ScanFieldDeterminer extends AbstractLogicalVisitor<Void, ScanFieldD } join.getLeft().accept(this, leftList); } - + { FieldList rightList = fl.clone(); for (JoinCondition c : join.getConditions()) { @@ -191,7 +192,7 @@ public class ScanFieldDeterminer extends AbstractLogicalVisitor<Void, ScanFieldD return null; } - + /** * Search through a LogicalExpression, finding all internal schema path references and returning them in a set. */ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/AggPruleBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/AggPruleBase.java index a61bfd6fe..e6c815b59 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/AggPruleBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/AggPruleBase.java @@ -69,7 +69,7 @@ public abstract class AggPruleBase extends Prule { for (AggregateCall aggCall : aggregate.getAggCallList()) { String name = aggCall.getAggregation().getName(); - if ( ! (name.equals("SUM") || name.equals("MIN") || name.equals("MAX") || name.equals("COUNT") + if ( ! (name.equals("SUM") || name.equals("MIN") || name.equals("MAX") || name.equals("COUNT") || name.equals("$SUM0"))) { return false; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/BroadcastExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/BroadcastExchangePrel.java index 39ab26b77..0c76de46b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/BroadcastExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/BroadcastExchangePrel.java @@ -19,8 +19,6 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.util.Collections; -import java.util.Iterator; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -29,7 +27,6 @@ import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ComplexToJsonPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ComplexToJsonPrel.java index 35e8278ad..bec3704bb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ComplexToJsonPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ComplexToJsonPrel.java @@ -35,7 +35,7 @@ public class ComplexToJsonPrel extends SingleRel implements Prel { super(phyRelNode.getCluster(), phyRelNode.getTraitSet(), phyRelNode); } - @Override + @Override public final RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new ComplexToJsonPrel((Prel) sole(inputs)); } @@ -70,5 +70,5 @@ public class ComplexToJsonPrel extends SingleRel implements Prel { public boolean needsFinalColumnReordering() { return true; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java index ce3227d6b..620cf1fb5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java @@ -27,10 +27,6 @@ import org.apache.drill.exec.planner.logical.DrillAggregateRel; import org.apache.drill.exec.planner.logical.DrillProjectRel; import org.apache.drill.exec.planner.logical.DrillScanRel; import org.apache.drill.exec.planner.logical.RelOptHelper; -import org.apache.drill.exec.planner.physical.DrillDistributionTrait; -import org.apache.drill.exec.planner.physical.Prel; -import org.apache.drill.exec.planner.physical.ProjectPrel; -import org.apache.drill.exec.planner.physical.ScanPrel; import org.apache.drill.exec.store.direct.DirectGroupScan; import org.apache.drill.exec.store.pojo.PojoRecordReader; import org.eigenbase.rel.AggregateCall; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTrait.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTrait.java index df49ee333..c45ae179b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTrait.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTrait.java @@ -35,7 +35,7 @@ public class DrillDistributionTrait implements RelTrait { private DistributionType type; private final ImmutableList<DistributionField> fields; - + public DrillDistributionTrait(DistributionType type) { assert (type == DistributionType.SINGLETON || type == DistributionType.RANDOM_DISTRIBUTED || type == DistributionType.ANY || type == DistributionType.ROUND_ROBIN_DISTRIBUTED || type == DistributionType.BROADCAST_DISTRIBUTED); @@ -68,7 +68,7 @@ public class DrillDistributionTrait implements RelTrait { // Following can satisfy the requirements: {a}, {b}, {c}, {a, b}, {b, c}, {a, c} or {a, b, c} // New: Use equals for subsumes check of hash distribution. If we uses subsumes, - // a join may end up with hash-distributions using different keys. This would + // a join may end up with hash-distributions using different keys. This would // cause incorrect query result. return this.equals(trait); } @@ -93,10 +93,12 @@ public class DrillDistributionTrait implements RelTrait { return fields; } + @Override public int hashCode() { return fields == null ? type.hashCode() : type.hashCode() | fields.hashCode() << 4 ; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -124,6 +126,7 @@ public class DrillDistributionTrait implements RelTrait { this.fieldId = fieldId; } + @Override public boolean equals(Object obj) { if (!(obj instanceof DistributionField)) { return false; @@ -132,6 +135,7 @@ public class DrillDistributionTrait implements RelTrait { return this.fieldId == other.fieldId; } + @Override public int hashCode() { return this.fieldId; } @@ -140,6 +144,7 @@ public class DrillDistributionTrait implements RelTrait { return this.fieldId; } + @Override public String toString() { return String.format("[$%s]", this.fieldId); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTraitDef.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTraitDef.java index 06c231995..6a1dbb728 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTraitDef.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillDistributionTraitDef.java @@ -23,56 +23,61 @@ import org.eigenbase.relopt.RelTraitDef; public class DrillDistributionTraitDef extends RelTraitDef<DrillDistributionTrait>{ public static final DrillDistributionTraitDef INSTANCE = new DrillDistributionTraitDef(); - + private DrillDistributionTraitDef() { super(); } - + + @Override public boolean canConvert( RelOptPlanner planner, DrillDistributionTrait fromTrait, DrillDistributionTrait toTrait) { return true; - } + } + @Override public Class<DrillDistributionTrait> getTraitClass(){ return DrillDistributionTrait.class; } - + + @Override public DrillDistributionTrait getDefault() { return DrillDistributionTrait.DEFAULT; } + @Override public String getSimpleName() { return this.getClass().getSimpleName(); } - + // implement RelTraitDef + @Override public RelNode convert( RelOptPlanner planner, RelNode rel, DrillDistributionTrait toDist, boolean allowInfiniteCostConverters) { - + DrillDistributionTrait currentDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE); - + // Source and Target have the same trait. if (currentDist.equals(toDist)) { return rel; } - + // Source trait is "ANY", which is abstract type of distribution. - // We do not want to convert from "ANY", since it's abstract. + // We do not want to convert from "ANY", since it's abstract. // Source trait should be concrete type: SINGLETON, HASH_DISTRIBUTED, etc. if (currentDist.equals(DrillDistributionTrait.DEFAULT)) { return null; } - + switch(toDist.getType()){ // UnionExchange, HashToRandomExchange, OrderedPartitionExchange and BroadcastExchange destroy the ordering property, // therefore RelCollation is set to default, which is EMPTY. - case SINGLETON: + case SINGLETON: return new UnionExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel); case HASH_DISTRIBUTED: - return new HashToRandomExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel, + return new HashToRandomExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel, toDist.getFields()); case RANGE_DISTRIBUTED: return new OrderedPartitionExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillScanPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillScanPrel.java index b026c22a2..a452bac37 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillScanPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/DrillScanPrel.java @@ -20,7 +20,7 @@ package org.apache.drill.exec.planner.physical; import org.apache.drill.exec.physical.base.GroupScan; public interface DrillScanPrel extends Prel{ - + public GroupScan getGroupScan(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java index 996e80a15..99d000cd6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java @@ -25,16 +25,11 @@ import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.Filter; import org.apache.drill.exec.planner.common.DrillFilterRelBase; -import org.apache.drill.exec.planner.cost.DrillCostBase; -import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.planner.logical.DrillParseContext; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; -import org.eigenbase.relopt.RelOptCost; -import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.rex.RexNode; @@ -84,5 +79,5 @@ public class FilterPrel extends DrillFilterRelBase implements Prel { public boolean needsFinalColumnReordering() { return true; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java index c1b1fba01..0b9dcb6cf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrel.java @@ -17,6 +17,10 @@ */ package org.apache.drill.exec.planner.physical; +import java.io.IOException; +import java.util.BitSet; +import java.util.List; + import org.apache.drill.common.logical.data.NamedExpression; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.expr.holders.IntHolder; @@ -35,10 +39,6 @@ import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; -import java.io.IOException; -import java.util.BitSet; -import java.util.List; - public class HashAggPrel extends AggPrelBase implements Prel{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HashAggPrel.class); @@ -48,6 +48,7 @@ public class HashAggPrel extends AggPrelBase implements Prel{ super(cluster, traits, child, groupSet, aggCalls, phase); } + @Override public AggregateRelBase copy(RelTraitSet traitSet, RelNode input, BitSet groupSet, List<AggregateCall> aggCalls) { try { return new HashAggPrel(getCluster(), traitSet, input, getGroupSet(), aggCalls, diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrule.java index e2ee57f20..0439bbb01 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashAggPrule.java @@ -17,7 +17,8 @@ */ package org.apache.drill.exec.planner.physical; -import com.google.common.collect.ImmutableList; +import java.util.logging.Logger; + import org.apache.drill.exec.planner.logical.DrillAggregateRel; import org.apache.drill.exec.planner.logical.RelOptHelper; import org.apache.drill.exec.planner.physical.AggPrelBase.OperatorPhase; @@ -29,7 +30,7 @@ import org.eigenbase.relopt.RelTrait; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.trace.EigenbaseTrace; -import java.util.logging.Logger; +import com.google.common.collect.ImmutableList; public class HashAggPrule extends AggPruleBase { public static final RelOptRule INSTANCE = new HashAggPrule(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrel.java index aaf18b120..d9a72777c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrel.java @@ -17,7 +17,9 @@ */ package org.apache.drill.exec.planner.physical; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; + import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.logical.data.JoinCondition; import org.apache.drill.exec.ExecConstants; @@ -40,8 +42,7 @@ import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.rex.RexNode; import org.eigenbase.util.Pair; -import java.io.IOException; -import java.util.List; +import com.google.common.collect.Lists; public class HashJoinPrel extends JoinPrel { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrule.java index 858842568..61321c17a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashJoinPrule.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.planner.physical; +import java.util.logging.Logger; + import org.apache.drill.exec.planner.logical.DrillJoinRel; import org.apache.drill.exec.planner.logical.RelOptHelper; import org.eigenbase.rel.InvalidRelException; @@ -25,8 +27,6 @@ import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.trace.EigenbaseTrace; -import java.util.logging.Logger; - public class HashJoinPrule extends JoinPruleBase { public static final RelOptRule INSTANCE = new HashJoinPrule(); protected static final Logger tracer = EigenbaseTrace.getPlannerTracer(); @@ -41,7 +41,7 @@ public class HashJoinPrule extends JoinPruleBase { PlannerSettings settings = PrelUtil.getPlannerSettings(call.getPlanner()); return settings.isMemoryEstimationEnabled() || settings.isHashJoinEnabled(); } - + @Override public void onMatch(RelOptRuleCall call) { if (!PrelUtil.getPlannerSettings(call.getPlanner()).isHashJoinEnabled()) return; @@ -49,23 +49,23 @@ public class HashJoinPrule extends JoinPruleBase { final DrillJoinRel join = (DrillJoinRel) call.rel(0); final RelNode left = join.getLeft(); final RelNode right = join.getRight(); - + if (!checkPreconditions(join, left, right)) { return; } - + boolean hashSingleKey = PrelUtil.getPlannerSettings(call.getPlanner()).isHashSingleKey(); - + try { createDistBothPlan(call, join, PhysicalJoinType.HASH_JOIN, left, right, null /* left collation */, null /* right collation */, hashSingleKey); - + if (checkBroadcastConditions(call.getPlanner(), join, left, right)) { createBroadcastPlan(call, join, PhysicalJoinType.HASH_JOIN, left, right, null /* left collation */, null /* right collation */); // createBroadcastPlan1(call, join, PhysicalJoinType.HASH_JOIN, left, right, null, null); } - + } catch (InvalidRelException e) { tracer.warning(e.toString()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToMergeExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToMergeExchangePrel.java index 4518e17c9..95ef876f1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToMergeExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToMergeExchangePrel.java @@ -18,25 +18,21 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.util.Iterator; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.HashToMergeExchange; -import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.planner.physical.DrillDistributionTrait.DistributionField; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelCollation; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataTypeField; public class HashToMergeExchangePrel extends ExchangePrel { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToRandomExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToRandomExchangePrel.java index b78e64cd9..30107bb68 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToRandomExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/HashToRandomExchangePrel.java @@ -24,21 +24,17 @@ import net.hydromatic.linq4j.Ord; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.HashToRandomExchange; -import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.planner.physical.DrillDistributionTrait.DistributionField; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.RelWriter; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataTypeField; -import org.eigenbase.rex.RexNode; public class HashToRandomExchangePrel extends ExchangePrel { @@ -57,8 +53,8 @@ public class HashToRandomExchangePrel extends ExchangePrel { * If there are N nodes (endpoints), we can assume for costing purposes * on average each sender will send M/N rows to 1 destination endpoint. * (See DrillCostBase for symbol notations) - * Include impact of skewness of distribution : the more keys used, the less likely the distribution will be skewed. - * The hash cpu cost will be proportional to 1 / #_keys. + * Include impact of skewness of distribution : the more keys used, the less likely the distribution will be skewed. + * The hash cpu cost will be proportional to 1 / #_keys. * C = CPU cost of hashing k fields of M/N rows * + CPU cost of SV remover for M/N rows * + Network cost of sending M/N rows to 1 destination. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java index cf996dc6d..d5473f24e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPrel.java @@ -99,6 +99,6 @@ public abstract class JoinPrel extends DrillJoinRelBase implements Prel{ @Override public boolean needsFinalColumnReordering() { return true; - } - + } + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPruleBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPruleBase.java index d6bd71141..babf00569 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPruleBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/JoinPruleBase.java @@ -28,12 +28,10 @@ import org.eigenbase.rel.RelCollation; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptPlanner; -import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.relopt.RelOptRuleOperand; import org.eigenbase.relopt.RelOptUtil; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.relopt.volcano.RelSubset; import org.eigenbase.rex.RexNode; import com.google.common.collect.ImmutableList; @@ -189,6 +187,7 @@ public abstract class JoinPruleBase extends Prule { new SubsetTransformer<DrillJoinRel, InvalidRelException>(call){ + @Override public RelNode convertChild(final DrillJoinRel join, final RelNode rel) throws InvalidRelException { DrillDistributionTrait toDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE); RelTraitSet newTraitsLeft; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrel.java index a4bb50355..5060195bd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrel.java @@ -18,28 +18,19 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.math.BigDecimal; import java.util.Iterator; import java.util.List; -import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.exec.physical.base.PhysicalOperator; -import org.apache.drill.exec.physical.config.Filter; import org.apache.drill.exec.physical.config.Limit; import org.apache.drill.exec.planner.common.DrillLimitRelBase; -import org.apache.drill.exec.planner.logical.DrillImplementor; -import org.apache.drill.exec.planner.logical.DrillParseContext; -import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; -import org.apache.drill.exec.planner.torel.ConversionContext; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; -import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.rex.RexLiteral; import org.eigenbase.rex.RexNode; -import org.eigenbase.sql.type.SqlTypeName; public class LimitPrel extends DrillLimitRelBase implements Prel { @@ -93,7 +84,7 @@ public class LimitPrel extends DrillLimitRelBase implements Prel { public boolean needsFinalColumnReordering() { return true; } - + // @Override // public LogicalOperator implement(DrillImplementor implementor) { // LogicalOperator inputOp = implementor.visitChild(this, 0, getChild()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrule.java index aad297620..94685c10c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/LimitPrule.java @@ -17,10 +17,8 @@ */ package org.apache.drill.exec.planner.physical; -import org.apache.drill.exec.planner.common.DrillScreenRelBase; import org.apache.drill.exec.planner.logical.DrillLimitRel; import org.apache.drill.exec.planner.logical.DrillRel; -import org.apache.drill.exec.planner.logical.DrillScreenRel; import org.apache.drill.exec.planner.logical.RelOptHelper; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptRule; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/MergeJoinPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/MergeJoinPrule.java index a11e3898c..faffa63cf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/MergeJoinPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/MergeJoinPrule.java @@ -27,14 +27,10 @@ import org.eigenbase.rel.RelCollation; import org.eigenbase.rel.RelCollationImpl; import org.eigenbase.rel.RelFieldCollation; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; -import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.relopt.volcano.RelSubset; import org.eigenbase.trace.EigenbaseTrace; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; public class MergeJoinPrule extends JoinPruleBase { @@ -51,7 +47,7 @@ public class MergeJoinPrule extends JoinPruleBase { public boolean matches(RelOptRuleCall call) { return PrelUtil.getPlannerSettings(call.getPlanner()).isMergeJoinEnabled(); } - + @Override public void onMatch(RelOptRuleCall call) { final DrillJoinRel join = (DrillJoinRel) call.rel(0); @@ -61,10 +57,10 @@ public class MergeJoinPrule extends JoinPruleBase { if (!checkPreconditions(join, left, right)) { return; } - + boolean hashSingleKey = PrelUtil.getPlannerSettings(call.getPlanner()).isHashSingleKey(); - - try { + + try { RelCollation collationLeft = getCollation(join.getLeftKeys()); RelCollation collationRight = getCollation(join.getRightKeys()); @@ -78,8 +74,8 @@ public class MergeJoinPrule extends JoinPruleBase { tracer.warning(e.toString()); } } - - private RelCollation getCollation(List<Integer> keys){ + + private RelCollation getCollation(List<Integer> keys){ List<RelFieldCollation> fields = Lists.newArrayList(); for (int key : keys) { fields.add(new RelFieldCollation(key)); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/OrderedPartitionExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/OrderedPartitionExchangePrel.java index 36a67cb58..7bb4822dd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/OrderedPartitionExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/OrderedPartitionExchangePrel.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.util.Iterator; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -26,7 +25,6 @@ import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PhysicalPlanCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PhysicalPlanCreator.java index 130ac870a..6094221ce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PhysicalPlanCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/PhysicalPlanCreator.java @@ -31,7 +31,6 @@ import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.planner.physical.explain.PrelSequencer.OpId; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class PhysicalPlanCreator { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProducerConsumerPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProducerConsumerPrel.java index 690376746..a9edd0ca0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProducerConsumerPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProducerConsumerPrel.java @@ -17,6 +17,10 @@ */ package org.apache.drill.exec.planner.physical; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.ProducerConsumer; import org.apache.drill.exec.planner.common.DrillRelNode; @@ -24,13 +28,8 @@ import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.SingleRel; -import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - public class ProducerConsumerPrel extends SingleRel implements DrillRelNode, Prel { private int queueSize; @@ -75,10 +74,10 @@ public class ProducerConsumerPrel extends SingleRel implements DrillRelNode, Pre public SelectionVectorMode getEncoding() { return SelectionVectorMode.NONE; } - + @Override public boolean needsFinalColumnReordering() { return true; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java index a67dbf2a5..57dfdb489 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectAllowDupPrel.java @@ -28,7 +28,6 @@ import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.Project; import org.apache.drill.exec.planner.logical.DrillOptiq; import org.apache.drill.exec.planner.logical.DrillParseContext; -import org.apache.drill.exec.planner.physical.ProjectPrel; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; @@ -55,6 +54,7 @@ public class ProjectAllowDupPrel extends ProjectPrel { return creator.addMetadata(this, p); } + @Override protected List<NamedExpression> getProjectExpressions(DrillParseContext context) { List<NamedExpression> expressions = Lists.newArrayList(); for (Pair<RexNode, String> pair : Pair.zip(exps, getRowType().getFieldNames())) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrel.java index ae21c2c15..1f621da71 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrel.java @@ -18,14 +18,11 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.Project; -import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.planner.common.DrillProjectRelBase; import org.apache.drill.exec.planner.logical.DrillParseContext; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; @@ -46,6 +43,7 @@ public class ProjectPrel extends DrillProjectRelBase implements Prel{ super(DRILL_PHYSICAL, cluster, traits, child, exps, rowType); } + @Override public ProjectRelBase copy(RelTraitSet traitSet, RelNode input, List<RexNode> exps, RelDataType rowType) { return new ProjectPrel(getCluster(), traitSet, input, exps, rowType); } @@ -85,5 +83,5 @@ public class ProjectPrel extends DrillProjectRelBase implements Prel{ public boolean needsFinalColumnReordering() { return false; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java index 833aaae4e..6d2641977 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrule.java @@ -35,7 +35,6 @@ import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.relopt.volcano.RelSubset; import org.eigenbase.rex.RexCall; import org.eigenbase.rex.RexInputRef; import org.eigenbase.rex.RexNode; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScanPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScanPrule.java index 606bbcb28..1d915b7fa 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScanPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScanPrule.java @@ -17,9 +17,6 @@ */ package org.apache.drill.exec.planner.physical; -import java.util.List; - -import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.physical.base.GroupScan; import org.apache.drill.exec.planner.logical.DrillScanRel; import org.apache.drill.exec.planner.logical.RelOptHelper; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScreenPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScreenPrel.java index 1a4da8a65..43565150b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScreenPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ScreenPrel.java @@ -23,7 +23,6 @@ import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.Screen; -import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.planner.common.DrillScreenRelBase; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; @@ -74,7 +73,7 @@ public class ScreenPrel extends DrillScreenRelBase implements Prel { public SelectionVectorMode getEncoding() { return SelectionVectorMode.NONE; } - + @Override public boolean needsFinalColumnReordering() { return false; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SelectionVectorRemoverPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SelectionVectorRemoverPrel.java index 042809f54..aea51925e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SelectionVectorRemoverPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SelectionVectorRemoverPrel.java @@ -26,8 +26,6 @@ import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataType; -import org.eigenbase.rex.RexNode; public class SelectionVectorRemoverPrel extends SinglePrel{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVectorRemoverPrel.class); @@ -40,6 +38,7 @@ public class SelectionVectorRemoverPrel extends SinglePrel{ super(cluster, traits, child); } + @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new SelectionVectorRemoverPrel(this.getCluster(), traitSet, inputs.get(0)); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SingleMergeExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SingleMergeExchangePrel.java index bea5500b3..16bfd88f6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SingleMergeExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SingleMergeExchangePrel.java @@ -31,7 +31,6 @@ import org.eigenbase.rel.RelCollation; import org.eigenbase.rel.RelFieldCollation; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.RelWriter; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SinglePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SinglePrel.java index 3199943a4..914ee04ec 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SinglePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SinglePrel.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.planner.physical; -import java.util.Collections; import java.util.Iterator; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortConvertPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortConvertPrule.java index f2723cfc1..a9955a3d9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortConvertPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortConvertPrule.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.planner.physical; -import org.apache.drill.exec.planner.logical.DrillRel; -import org.apache.drill.exec.planner.logical.DrillSortRel; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.SortRel; import org.eigenbase.rel.convert.ConverterRule; @@ -28,9 +26,9 @@ import org.eigenbase.relopt.RelOptRuleCall; /** * Rule that converts an {@link SortRel} to a physical {@link SortPrel}, implemented by a Drill "order" operation. - * - * The {@link SortRel} is added in optiq's AbstractConvert call, when it enforces certain "order" to the input stream. - * Drill uses this rule to convert such sort enforcer into physical {@link SortPrel}. + * + * The {@link SortRel} is added in optiq's AbstractConvert call, when it enforces certain "order" to the input stream. + * Drill uses this rule to convert such sort enforcer into physical {@link SortPrel}. */ public class SortConvertPrule extends ConverterRule { public static final RelOptRule INSTANCE = new SortConvertPrule("SortConvertPrule", Convention.NONE); @@ -49,9 +47,9 @@ public class SortConvertPrule extends ConverterRule { @Override public RelNode convert(RelNode r) { SortRel rel = (SortRel) r; - return new SortPrel(rel.getCluster(), - rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL).plus(rel.getCollation()), - convert(rel.getChild(), rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL)), + return new SortPrel(rel.getCluster(), + rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL).plus(rel.getCollation()), + convert(rel.getChild(), rel.getChild().getTraitSet().replace(Prel.DRILL_PHYSICAL)), rel.getCollation()); } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrel.java index 0926f601f..8156843f6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrel.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.planner.physical; +import java.io.IOException; +import java.util.Iterator; + import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.ExternalSort; @@ -35,9 +38,6 @@ import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.rex.RexNode; -import java.io.IOException; -import java.util.Iterator; - public class SortPrel extends SortRel implements Prel { /** Creates a DrillSortRel. */ @@ -86,6 +86,7 @@ public class SortPrel extends SortRel implements Prel { return creator.addMetadata(this, g); } + @Override public SortPrel copy( RelTraitSet traitSet, RelNode newInput, @@ -114,10 +115,10 @@ public class SortPrel extends SortRel implements Prel { public SelectionVectorMode getEncoding() { return SelectionVectorMode.FOUR_BYTE; } - + @Override public boolean needsFinalColumnReordering() { return true; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrule.java index 94b70c40a..2ebd015c8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/SortPrule.java @@ -19,17 +19,12 @@ package org.apache.drill.exec.planner.physical; import java.util.List; -import net.hydromatic.optiq.util.BitSets; - -import org.apache.drill.exec.planner.common.DrillProjectRelBase; -import org.apache.drill.exec.planner.logical.DrillAggregateRel; import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.logical.DrillSortRel; import org.apache.drill.exec.planner.logical.RelOptHelper; import org.apache.drill.exec.planner.physical.DrillDistributionTrait.DistributionField; import org.eigenbase.rel.RelFieldCollation; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.SortRel; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.relopt.RelTraitSet; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java index eaef94b79..e8a70f2ce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrel.java @@ -27,7 +27,6 @@ import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.config.StreamingAggregate; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; -import org.apache.drill.exec.planner.logical.DrillParseContext; import org.apache.drill.exec.planner.physical.visitor.PrelVisitor; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.AggregateCall; @@ -51,6 +50,7 @@ public class StreamAggPrel extends AggPrelBase implements Prel{ super(cluster, traits, child, groupSet, aggCalls, phase); } + @Override public AggregateRelBase copy(RelTraitSet traitSet, RelNode input, BitSet groupSet, List<AggregateCall> aggCalls) { try { return new StreamAggPrel(getCluster(), traitSet, input, getGroupSet(), aggCalls, diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrule.java index b5b036492..89b133a08 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/StreamAggPrule.java @@ -23,7 +23,6 @@ import java.util.logging.Logger; import net.hydromatic.optiq.util.BitSets; import org.apache.drill.exec.planner.logical.DrillAggregateRel; -import org.apache.drill.exec.planner.logical.DrillJoinRel; import org.apache.drill.exec.planner.logical.RelOptHelper; import org.apache.drill.exec.planner.physical.AggPrelBase.OperatorPhase; import org.eigenbase.rel.InvalidRelException; @@ -34,7 +33,6 @@ import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptRule; import org.eigenbase.relopt.RelOptRuleCall; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.relopt.volcano.RelSubset; import org.eigenbase.trace.EigenbaseTrace; import com.google.common.collect.ImmutableList; @@ -76,6 +74,7 @@ public class StreamAggPrule extends AggPruleBase { RelNode convertedInput = convert(input, traits); new SubsetTransformer<DrillAggregateRel, InvalidRelException>(call){ + @Override public RelNode convertChild(final DrillAggregateRel join, final RelNode rel) throws InvalidRelException { DrillDistributionTrait toDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE); RelTraitSet traits = newTraitSet(Prel.DRILL_PHYSICAL, toDist); @@ -127,6 +126,7 @@ public class StreamAggPrule extends AggPruleBase { new SubsetTransformer<DrillAggregateRel, InvalidRelException>(call){ + @Override public RelNode convertChild(final DrillAggregateRel aggregate, final RelNode rel) throws InvalidRelException { DrillDistributionTrait toDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE); RelTraitSet traits = newTraitSet(Prel.DRILL_PHYSICAL, collation, toDist); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/TopNPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/TopNPrel.java index 997c1c7bb..ac1811bce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/TopNPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/TopNPrel.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.planner.physical; import java.io.IOException; -import java.util.Iterator; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -29,14 +28,11 @@ import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelCollation; import org.eigenbase.rel.RelNode; import org.eigenbase.rel.RelWriter; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.rex.RexLiteral; -import org.eigenbase.rex.RexNode; public class TopNPrel extends SinglePrel { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java index bcddce687..869493f26 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionAllPrule.java @@ -43,27 +43,27 @@ public class UnionAllPrule extends Prule { @Override public boolean matches(RelOptRuleCall call) { DrillUnionRel union = (DrillUnionRel) call.rel(0); - return (! union.isDistinct()); + return (! union.isDistinct()); } - + @Override public void onMatch(RelOptRuleCall call) { final DrillUnionRel union = (DrillUnionRel) call.rel(0); final List<RelNode> inputs = union.getInputs(); List<RelNode> convertedInputList = Lists.newArrayList(); RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL); - + try { for (int i = 0; i < inputs.size(); i++) { RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits)); - convertedInputList.add(convertedInput); + convertedInputList.add(convertedInput); } - + traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON); UnionAllPrel unionAll = new UnionAllPrel(union.getCluster(), traits, convertedInputList); call.transformTo(unionAll); - + } catch (InvalidRelException e) { tracer.warning(e.toString()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrule.java index 7cd57339e..67a817e8b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionDistinctPrule.java @@ -45,25 +45,25 @@ public class UnionDistinctPrule extends Prule { DrillUnionRel union = (DrillUnionRel) call.rel(0); return (union.isDistinct() && union.isHomogeneous(false /* don't compare names */)); } - + @Override public void onMatch(RelOptRuleCall call) { final DrillUnionRel union = (DrillUnionRel) call.rel(0); final List<RelNode> inputs = union.getInputs(); List<RelNode> convertedInputList = Lists.newArrayList(); RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL); - + try { for (int i = 0; i < inputs.size(); i++) { RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits)); - convertedInputList.add(convertedInput); + convertedInputList.add(convertedInput); } - + traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON); UnionDistinctPrel unionDistinct = new UnionDistinctPrel(union.getCluster(), traits, convertedInputList); call.transformTo(unionDistinct); - + } catch (InvalidRelException e) { tracer.warning(e.toString()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionExchangePrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionExchangePrel.java index 3fd6e320c..8b0c2519c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionExchangePrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionExchangePrel.java @@ -21,14 +21,11 @@ import java.io.IOException; import java.util.List; import org.apache.drill.exec.physical.base.PhysicalOperator; -import org.apache.drill.exec.physical.config.Screen; -import org.apache.drill.exec.physical.config.SelectionVectorRemover; import org.apache.drill.exec.physical.config.UnionExchange; import org.apache.drill.exec.planner.cost.DrillCostBase; import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; -import org.eigenbase.rel.SingleRel; import org.eigenbase.rel.metadata.RelMetadataQuery; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionPrel.java index dd1d018ce..a1f300b25 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/UnionPrel.java @@ -27,7 +27,6 @@ import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataType; public abstract class UnionPrel extends DrillUnionRelBase implements Prel{ @@ -44,7 +43,7 @@ public abstract class UnionPrel extends DrillUnionRelBase implements Prel{ public Iterator<Prel> iterator() { return PrelUtil.iter(this.getInputs()); } - + @Override public boolean needsFinalColumnReordering() { return false; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrel.java index d9db36e2a..dc3d6dfa2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrel.java @@ -29,11 +29,6 @@ import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelTraitSet; -import org.eigenbase.reltype.RelDataType; -import org.eigenbase.sql.type.SqlTypeName; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; public class WriterPrel extends DrillWriterRelBase implements Prel { @@ -77,10 +72,10 @@ public class WriterPrel extends DrillWriterRelBase implements Prel { public SelectionVectorMode getEncoding() { return SelectionVectorMode.NONE; } - + @Override public boolean needsFinalColumnReordering() { return true; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrule.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrule.java index f3057e636..6bd89b0b0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrule.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/WriterPrule.java @@ -60,11 +60,11 @@ public class WriterPrule extends Prule{ public RelNode convertChild(DrillWriterRelBase writer, RelNode rel) throws RuntimeException { DrillDistributionTrait childDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE); - // Create the Writer with the child's distribution because the degree of parallelism for the writer - // should correspond to the number of child minor fragments. The Writer itself is not concerned with - // the collation of the child. Note that the Writer's output RowType consists of - // {fragment_id varchar(255), number_of_records_written bigint} which are very different from the - // child's output RowType. + // Create the Writer with the child's distribution because the degree of parallelism for the writer + // should correspond to the number of child minor fragments. The Writer itself is not concerned with + // the collation of the child. Note that the Writer's output RowType consists of + // {fragment_id varchar(255), number_of_records_written bigint} which are very different from the + // child's output RowType. return new WriterPrel(writer.getCluster(), writer.getTraitSet().plus(childDist).plus(Prel.DRILL_PHYSICAL), rel, writer.getCreateTableEntry()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/explain/PrelSequencer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/explain/PrelSequencer.java index ebff287d4..c3020cf2d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/explain/PrelSequencer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/explain/PrelSequencer.java @@ -25,7 +25,6 @@ import java.util.Map; import java.util.Queue; import org.apache.drill.exec.planner.physical.ExchangePrel; -import org.apache.drill.exec.planner.physical.JoinPrel; import org.apache.drill.exec.planner.physical.Prel; import org.apache.drill.exec.planner.physical.visitor.BasePrelVisitor; import org.eigenbase.rel.RelWriter; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ExcessiveExchangeIdentifier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ExcessiveExchangeIdentifier.java index 06b72f91c..eb8eab337 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ExcessiveExchangeIdentifier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ExcessiveExchangeIdentifier.java @@ -25,7 +25,6 @@ import org.apache.drill.exec.planner.physical.Prel; import org.apache.drill.exec.planner.physical.ScanPrel; import org.apache.drill.exec.planner.physical.ScreenPrel; import org.eigenbase.rel.RelNode; -import org.eigenbase.relopt.RelOptCost; import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/FinalColumnReorderer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/FinalColumnReorderer.java index 85f5ba3c1..c0556e3b8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/FinalColumnReorderer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/FinalColumnReorderer.java @@ -47,11 +47,11 @@ public class FinalColumnReorderer extends BasePrelVisitor<Prel, Void, RuntimeExc } private Prel addTrivialOrderedProjectPrel(Prel prel){ - + if ( !prel.needsFinalColumnReordering()) { return prel; } - + RelDataType t = prel.getRowType(); RexBuilder b = prel.getCluster().getRexBuilder(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ProducerConsumerPrelVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ProducerConsumerPrelVisitor.java index 575b4b42c..2cbf790f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ProducerConsumerPrelVisitor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/ProducerConsumerPrelVisitor.java @@ -17,15 +17,14 @@ */ package org.apache.drill.exec.planner.physical.visitor; -import com.google.common.collect.Lists; +import java.util.List; + import org.apache.drill.exec.planner.physical.Prel; import org.apache.drill.exec.planner.physical.ProducerConsumerPrel; import org.apache.drill.exec.planner.physical.ScanPrel; -import org.apache.drill.exec.planner.physical.SelectionVectorRemoverPrel; -import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.eigenbase.rel.RelNode; -import java.util.List; +import com.google.common.collect.Lists; public class ProducerConsumerPrelVisitor extends BasePrelVisitor<Prel, Void, RuntimeException>{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RelUniqifier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RelUniqifier.java index c5bf2933a..4f7f3482e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RelUniqifier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/RelUniqifier.java @@ -23,8 +23,8 @@ import java.util.Set; import org.apache.drill.exec.planner.physical.Prel; import org.eigenbase.rel.RelNode; -import com.google.common.collect.Sets; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; public class RelUniqifier extends BasePrelVisitor<Prel, Set<Prel>, RuntimeException>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RelUniqifier.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillConvertletTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillConvertletTable.java index f1bda60fd..7c8989762 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillConvertletTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillConvertletTable.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.planner.sql; +import java.util.HashMap; + import org.eigenbase.sql.SqlCall; import org.eigenbase.sql.SqlOperator; import org.eigenbase.sql.fun.SqlStdOperatorTable; @@ -24,8 +26,6 @@ import org.eigenbase.sql2rel.SqlRexConvertlet; import org.eigenbase.sql2rel.SqlRexConvertletTable; import org.eigenbase.sql2rel.StandardConvertletTable; -import java.util.HashMap; - public class DrillConvertletTable implements SqlRexConvertletTable{ public static HashMap<SqlOperator, SqlRexConvertlet> map = new HashMap<>(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java index d2559e7f1..31aa36458 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.planner.sql; +import java.util.LinkedList; +import java.util.List; + import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeFactory; import org.eigenbase.rex.RexBuilder; @@ -27,9 +30,6 @@ import org.eigenbase.sql.type.SqlTypeName; import org.eigenbase.sql2rel.SqlRexContext; import org.eigenbase.sql2rel.SqlRexConvertlet; -import java.util.LinkedList; -import java.util.List; - public class DrillExtractConvertlet implements SqlRexConvertlet { public final static DrillExtractConvertlet INSTANCE = new DrillExtractConvertlet(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java index e34d3d15a..85a5734f2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java @@ -17,13 +17,8 @@ */ package org.apache.drill.exec.planner.sql; -import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Set; -import com.google.common.collect.Sets; -import org.apache.drill.exec.expr.fn.DrillFuncHolder; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.eigenbase.sql.SqlFunctionCategory; import org.eigenbase.sql.SqlIdentifier; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java index 299712ef9..0b8668b38 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java @@ -19,30 +19,15 @@ package org.apache.drill.exec.planner.sql; import java.util.List; -import org.apache.drill.exec.planner.types.RelDataTypeDrillImpl; -import org.apache.drill.exec.planner.types.RelDataTypeHolder; import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeFactory; import org.eigenbase.sql.SqlAggFunction; import org.eigenbase.sql.SqlCall; -import org.eigenbase.sql.SqlCallBinding; import org.eigenbase.sql.SqlFunctionCategory; import org.eigenbase.sql.SqlIdentifier; import org.eigenbase.sql.SqlKind; -import org.eigenbase.sql.SqlLiteral; -import org.eigenbase.sql.SqlNode; -import org.eigenbase.sql.SqlOperandCountRange; -import org.eigenbase.sql.SqlOperatorBinding; -import org.eigenbase.sql.SqlSyntax; -import org.eigenbase.sql.SqlWriter; import org.eigenbase.sql.parser.SqlParserPos; -import org.eigenbase.sql.type.SqlOperandTypeChecker; -import org.eigenbase.sql.type.SqlOperandTypeInference; -import org.eigenbase.sql.type.SqlReturnTypeInference; import org.eigenbase.sql.type.SqlTypeName; -import org.eigenbase.sql.util.SqlBasicVisitor.ArgHandler; -import org.eigenbase.sql.util.SqlVisitor; -import org.eigenbase.sql.validate.SqlMonotonicity; import org.eigenbase.sql.validate.SqlValidator; import org.eigenbase.sql.validate.SqlValidatorScope; @@ -51,7 +36,7 @@ import com.google.common.collect.ImmutableList; public class DrillSqlAggOperator extends SqlAggFunction { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillSqlAggOperator.class); - + public DrillSqlAggOperator(String name, int argCount) { super(name, new SqlIdentifier(name, SqlParserPos.ZERO), SqlKind.OTHER_FUNCTION, DynamicReturnType.INSTANCE, null, new Checker(argCount), SqlFunctionCategory.USER_DEFINED_FUNCTION); } @@ -65,7 +50,7 @@ public class DrillSqlAggOperator extends SqlAggFunction { return factory.createSqlType(SqlTypeName.ANY); // return new RelDataTypeDrillImpl(new RelDataTypeHolder(), factory); } - + @Override public List<RelDataType> getParameterTypes(RelDataTypeFactory typeFactory) { return ImmutableList.of(typeFactory.createSqlType(SqlTypeName.ANY)); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java index 2eeb26e64..55a8595fd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java @@ -22,7 +22,6 @@ import org.eigenbase.reltype.RelDataType; import org.eigenbase.sql.SqlCall; import org.eigenbase.sql.SqlFunction; import org.eigenbase.sql.SqlFunctionCategory; -import org.eigenbase.sql.SqlKind; import org.eigenbase.sql.SqlIdentifier; import org.eigenbase.sql.parser.SqlParserPos; import org.eigenbase.sql.type.SqlTypeName; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicReturnType.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicReturnType.java index ee133307e..1fe1d27de 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicReturnType.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicReturnType.java @@ -20,9 +20,9 @@ package org.apache.drill.exec.planner.sql; import org.eigenbase.sql.type.ExplicitReturnTypeInference; class DynamicReturnType extends ExplicitReturnTypeInference { - + public static final DynamicReturnType INSTANCE = new DynamicReturnType(); - + public DynamicReturnType() { super(new DynamicType()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicType.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicType.java index 5b6556502..7255dae99 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicType.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicType.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.planner.sql; -import org.apache.drill.exec.planner.types.RelDataTypeDrillImpl; -import org.apache.drill.exec.planner.types.RelDataTypeHolder; import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeFactory; import org.eigenbase.reltype.RelProtoDataType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/FixedRange.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/FixedRange.java index d68b8f2b9..91a7c65d1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/FixedRange.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/FixedRange.java @@ -22,7 +22,7 @@ import org.eigenbase.sql.SqlOperandCountRange; class FixedRange implements SqlOperandCountRange{ private final int size; - + public FixedRange(int size) { super(); this.size = size; @@ -42,5 +42,5 @@ class FixedRange implements SqlOperandCountRange{ public int getMax() { return size; } - + }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AbstractSqlHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AbstractSqlHandler.java index 35045052d..8a52796b6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AbstractSqlHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AbstractSqlHandler.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.planner.sql.handlers; import java.io.IOException; import java.util.List; -import com.google.common.base.Joiner; import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.tools.RelConversionException; import net.hydromatic.optiq.tools.ValidationException; @@ -29,6 +28,8 @@ import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.store.AbstractSchema; import org.eigenbase.sql.SqlNode; +import com.google.common.base.Joiner; + public abstract class AbstractSqlHandler { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractSqlHandler.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java index b7d9bd7f3..66d49630f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java @@ -17,10 +17,14 @@ */ package org.apache.drill.exec.planner.sql.handlers; +import java.io.IOException; +import java.util.List; + import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.tools.Planner; import net.hydromatic.optiq.tools.RelConversionException; import net.hydromatic.optiq.tools.ValidationException; + import org.apache.drill.exec.ops.QueryContext; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.physical.base.PhysicalOperator; @@ -39,9 +43,6 @@ import org.eigenbase.relopt.RelOptUtil; import org.eigenbase.reltype.RelDataType; import org.eigenbase.sql.SqlNode; -import java.io.IOException; -import java.util.List; - public class CreateTableHandler extends DefaultSqlHandler { public CreateTableHandler(Planner planner, QueryContext context) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java index 994eea487..e63474f13 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java @@ -17,9 +17,9 @@ */ package org.apache.drill.exec.planner.sql.handlers; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collection; +import java.util.List; import net.hydromatic.optiq.tools.Planner; import net.hydromatic.optiq.tools.RelConversionException; @@ -63,9 +63,9 @@ import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.sql.SqlExplainLevel; import org.eigenbase.sql.SqlNode; -import java.io.IOException; -import java.util.Collection; -import java.util.List; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; public class DefaultSqlHandler extends AbstractSqlHandler { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DefaultSqlHandler.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SetOptionHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SetOptionHandler.java index 028f569e2..da85a3171 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SetOptionHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SetOptionHandler.java @@ -17,8 +17,11 @@ */ package org.apache.drill.exec.planner.sql.handlers; +import java.io.IOException; + import net.hydromatic.optiq.tools.RelConversionException; import net.hydromatic.optiq.tools.ValidationException; + import org.apache.drill.exec.ops.QueryContext; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.planner.sql.DirectPlan; @@ -27,8 +30,6 @@ import org.eigenbase.sql.SqlLiteral; import org.eigenbase.sql.SqlNode; import org.eigenbase.sql.SqlSetOption; -import java.io.IOException; - public class SetOptionHandler extends AbstractSqlHandler{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SetOptionHandler.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFileHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFileHandler.java index 17e80bd3e..3627a7b05 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFileHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFileHandler.java @@ -26,21 +26,17 @@ import net.hydromatic.optiq.tools.Planner; import net.hydromatic.optiq.tools.RelConversionException; import net.hydromatic.optiq.tools.ValidationException; -import org.apache.drill.exec.store.AbstractSchema; -import org.apache.drill.exec.store.SubSchemaWrapper; -import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory; -import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory.WorkspaceSchema; -import org.eigenbase.sql.SqlIdentifier; -import org.eigenbase.sql.SqlNode; - import org.apache.drill.exec.ops.QueryContext; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.planner.sql.DirectPlan; import org.apache.drill.exec.planner.sql.parser.SqlShowFiles; +import org.apache.drill.exec.store.AbstractSchema; +import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory.WorkspaceSchema; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; - -import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.Path; +import org.eigenbase.sql.SqlIdentifier; +import org.eigenbase.sql.SqlNode; public class ShowFileHandler extends DefaultSqlHandler { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFilesCommandResult.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFilesCommandResult.java index bcd30558f..949d972cf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFilesCommandResult.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFilesCommandResult.java @@ -18,12 +18,10 @@ package org.apache.drill.exec.planner.sql.handlers; +import java.sql.Timestamp; + import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import org.joda.time.MutableDateTime; - -import java.sql.Timestamp; -import java.util.Date; public class ShowFilesCommandResult { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java index 86eb69d05..ec5e2c932 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java @@ -20,11 +20,7 @@ package org.apache.drill.exec.planner.sql.handlers; import java.io.IOException; import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import net.hydromatic.optiq.SchemaPlus; -import net.hydromatic.optiq.Table; -import net.hydromatic.optiq.impl.ViewTable; import net.hydromatic.optiq.tools.Planner; import net.hydromatic.optiq.tools.RelConversionException; import net.hydromatic.optiq.tools.ValidationException; @@ -32,7 +28,6 @@ import net.hydromatic.optiq.tools.ValidationException; import org.apache.drill.exec.dotdrill.View; import org.apache.drill.exec.ops.QueryContext; import org.apache.drill.exec.physical.PhysicalPlan; -import org.apache.drill.exec.planner.logical.DrillViewTable; import org.apache.drill.exec.planner.sql.DirectPlan; import org.apache.drill.exec.planner.sql.parser.SqlCreateView; import org.apache.drill.exec.planner.sql.parser.SqlDropView; @@ -43,6 +38,8 @@ import org.eigenbase.rel.RelNode; import org.eigenbase.reltype.RelDataType; import org.eigenbase.sql.SqlNode; +import com.google.common.collect.ImmutableList; + public abstract class ViewHandler extends AbstractSqlHandler{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ViewHandler.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillCompoundIdentifier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillCompoundIdentifier.java index d718efa10..d5fa215f0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillCompoundIdentifier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillCompoundIdentifier.java @@ -27,8 +27,8 @@ import org.eigenbase.sql.SqlNode; import org.eigenbase.sql.fun.SqlStdOperatorTable; import org.eigenbase.sql.parser.SqlParserPos; -import com.google.common.collect.Lists; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; public class DrillCompoundIdentifier extends SqlIdentifier{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillParserUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillParserUtil.java index ed369033d..b3fec9ddc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillParserUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillParserUtil.java @@ -18,13 +18,14 @@ package org.apache.drill.exec.planner.sql.parser; -import com.google.common.collect.Lists; +import java.util.List; + import org.eigenbase.sql.SqlNode; import org.eigenbase.sql.SqlOperator; import org.eigenbase.sql.parser.SqlParserPos; import org.eigenbase.sql.parser.SqlParserUtil; -import java.util.List; +import com.google.common.collect.Lists; /** * Helper methods or constants used in parsing a SQL query. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillSqlCall.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillSqlCall.java index 5fa592a13..4005b8164 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillSqlCall.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillSqlCall.java @@ -18,9 +18,10 @@ package org.apache.drill.exec.planner.sql.parser; import net.hydromatic.optiq.tools.Planner; + import org.apache.drill.exec.ops.QueryContext; -import org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler; import org.apache.drill.exec.planner.sql.handlers.AbstractSqlHandler; +import org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler; import org.eigenbase.sql.SqlCall; import org.eigenbase.sql.parser.SqlParserPos; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateTable.java index 017073546..c4180a99d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateTable.java @@ -40,6 +40,7 @@ import com.google.common.collect.Lists; public class SqlCreateTable extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("CREATE_TABLE", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlCreateTable(pos, (SqlIdentifier) operands[0], (SqlNodeList) operands[1], operands[2]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateView.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateView.java index 3666b4ccc..ee9680109 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateView.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateView.java @@ -40,6 +40,7 @@ import com.google.common.collect.Lists; public class SqlCreateView extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("CREATE_VIEW", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlCreateView(pos, (SqlIdentifier) operands[0], (SqlNodeList) operands[1], operands[2], (SqlLiteral) operands[3]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDescribeTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDescribeTable.java index 15da82258..e1cda4f0e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDescribeTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDescribeTable.java @@ -48,6 +48,7 @@ public class SqlDescribeTable extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("DESCRIBE_TABLE", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlDescribeTable(pos, (SqlIdentifier) operands[0], (SqlIdentifier) operands[1], operands[2]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDropView.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDropView.java index 1d943901a..9b9e785ca 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDropView.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDropView.java @@ -39,6 +39,7 @@ import com.google.common.collect.ImmutableList; public class SqlDropView extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("DROP_VIEW", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlDropView(pos, (SqlIdentifier) operands[0]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowFiles.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowFiles.java index 690e5fd8c..50bbca3f7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowFiles.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowFiles.java @@ -45,6 +45,7 @@ public class SqlShowFiles extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("SHOW_FILES", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlShowFiles(pos, (SqlIdentifier) operands[0]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowSchemas.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowSchemas.java index faa69d107..7ccc91701 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowSchemas.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowSchemas.java @@ -46,6 +46,7 @@ public class SqlShowSchemas extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("SHOW_SCHEMAS", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlShowSchemas(pos, operands[0], operands[1]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowTables.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowTables.java index e66199a6c..15adb603f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowTables.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowTables.java @@ -48,6 +48,7 @@ public class SqlShowTables extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("SHOW_TABLES", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlShowTables(pos, (SqlIdentifier) operands[0], operands[1], operands[2]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlUseSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlUseSchema.java index 76c7df3a5..ed4695ed6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlUseSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlUseSchema.java @@ -42,6 +42,7 @@ public class SqlUseSchema extends DrillSqlCall { public static final SqlSpecialOperator OPERATOR = new SqlSpecialOperator("USE_SCHEMA", SqlKind.OTHER){ + @Override public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) { return new SqlUseSchema(pos, (SqlIdentifier) operands[0]); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/impl/DrillParserWithCompoundIdConverter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/impl/DrillParserWithCompoundIdConverter.java index 382456a62..18f1edca7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/impl/DrillParserWithCompoundIdConverter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/impl/DrillParserWithCompoundIdConverter.java @@ -17,14 +17,14 @@ */ package org.apache.drill.exec.planner.sql.parser.impl; +import java.io.Reader; + import org.apache.drill.exec.planner.sql.parser.CompoundIdentifierConverter; import org.eigenbase.sql.SqlNode; import org.eigenbase.sql.parser.SqlAbstractParserImpl; import org.eigenbase.sql.parser.SqlParserImplFactory; import org.eigenbase.sql.util.SqlVisitor; -import java.io.Reader; - public class DrillParserWithCompoundIdConverter extends DrillParserImpl { /** diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/torel/ConversionContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/torel/ConversionContext.java index 7456214ee..a4863693c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/torel/ConversionContext.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/torel/ConversionContext.java @@ -57,7 +57,7 @@ public class ConversionContext implements ToRelContext { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ConversionContext.class); private static final ConverterVisitor VISITOR = new ConverterVisitor(); - + private final Map<Scan, FieldList> scanFieldLists; private final RelOptCluster cluster; private final Prepare prepare; @@ -79,41 +79,41 @@ public class ConversionContext implements ToRelContext { assert scanFieldLists.containsKey(scan); return scanFieldLists.get(scan); } - - + + public RexBuilder getRexBuilder(){ return cluster.getRexBuilder(); } - + public RelTraitSet getLogicalTraits(){ RelTraitSet set = RelTraitSet.createEmpty(); set.add(DrillRel.DRILL_LOGICAL); return set; } - + public RelNode toRel(LogicalOperator operator) throws InvalidRelException{ return operator.accept(VISITOR, this); } - + public RexNode toRex(LogicalExpression e){ return null; } - + public RelDataTypeFactory getTypeFactory(){ return cluster.getTypeFactory(); } - + public RelOptTable getTable(Scan scan){ FieldList list = getFieldList(scan); - + return null; } - + @Override public RelNode expandView(RelDataType rowType, String queryString, List<String> schemaPath) { throw new UnsupportedOperationException(); } - + private static class ConverterVisitor extends AbstractLogicalVisitor<RelNode, ConversionContext, InvalidRelException>{ @Override @@ -138,7 +138,7 @@ public class ConversionContext implements ToRelContext { public RelNode visitOrder(Order order, ConversionContext context) throws InvalidRelException{ return DrillSortRel.convert(order, context); } - + @Override public RelNode visitJoin(Join join, ConversionContext context) throws InvalidRelException{ return DrillJoinRel.convert(join, context); @@ -159,7 +159,7 @@ public class ConversionContext implements ToRelContext { throws InvalidRelException { return DrillAggregateRel.convert(groupBy, context); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/DrillFixedRelDataTypeImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/DrillFixedRelDataTypeImpl.java index 3c3a5ba3c..8df342ecd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/DrillFixedRelDataTypeImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/DrillFixedRelDataTypeImpl.java @@ -17,7 +17,9 @@ */ package org.apache.drill.exec.planner.types; -import com.google.common.collect.Lists; +import java.util.Collections; +import java.util.List; + import org.eigenbase.reltype.RelDataTypeFactory; import org.eigenbase.reltype.RelDataTypeField; import org.eigenbase.reltype.RelDataTypeFieldImpl; @@ -26,8 +28,7 @@ import org.eigenbase.reltype.RelDataTypePrecedenceList; import org.eigenbase.sql.type.SqlTypeExplicitPrecedenceList; import org.eigenbase.sql.type.SqlTypeName; -import java.util.Collections; -import java.util.List; +import com.google.common.collect.Lists; /** * Implements RowType for fixed field list with ANY type. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/RelDataTypeDrillImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/RelDataTypeDrillImpl.java index bb9799245..ce67cb23b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/RelDataTypeDrillImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/RelDataTypeDrillImpl.java @@ -37,19 +37,19 @@ public class RelDataTypeDrillImpl extends RelDataTypeImpl { private final RelDataTypeFactory typeFactory; private final RelDataTypeHolder holder; - + public RelDataTypeDrillImpl(RelDataTypeHolder holder, RelDataTypeFactory typeFactory) { this.typeFactory = typeFactory; this.holder = holder; this.holder.setRelDataTypeFactory(typeFactory); computeDigest(); } - + @Override public List<RelDataTypeField> getFieldList() { return holder.getFieldList(typeFactory); } - + @Override public int getFieldCount() { return holder.getFieldCount(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java index bea7bbfe9..9054e3f89 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.record; import org.apache.drill.exec.exception.SchemaChangeException; -import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.PhysicalOperator; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/BatchSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/BatchSchema.java index 5af3fb8cb..72992747f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/BatchSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/BatchSchema.java @@ -18,11 +18,11 @@ package org.apache.drill.exec.record; -import com.google.common.collect.Lists; - import java.util.Iterator; import java.util.List; +import com.google.common.collect.Lists; + public class BatchSchema implements Iterable<MaterializedField> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BatchSchema.class); @@ -57,6 +57,7 @@ public class BatchSchema implements Iterable<MaterializedField> { return selectionVectorMode; } + @Override public BatchSchema clone() { List<MaterializedField> newFields = Lists.newArrayList(); newFields.addAll(fields); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/ExpandableHyperContainer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/ExpandableHyperContainer.java index 48f84ab74..b8c5a8f62 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/ExpandableHyperContainer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/ExpandableHyperContainer.java @@ -17,12 +17,8 @@ */ package org.apache.drill.exec.record; -import org.apache.drill.common.expression.ExpressionPosition; -import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.vector.ValueVector; -import java.util.Iterator; - public class ExpandableHyperContainer extends VectorContainer { public ExpandableHyperContainer() { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/FragmentWritableBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/FragmentWritableBatch.java index e85eab1fc..f0453d97b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/FragmentWritableBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/FragmentWritableBatch.java @@ -17,30 +17,30 @@ */ package org.apache.drill.exec.record; -import com.google.common.collect.Lists; import io.netty.buffer.ByteBuf; +import java.util.List; + import org.apache.drill.exec.proto.BitData.FragmentRecordBatch; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.UserBitShared.QueryId; import org.apache.drill.exec.proto.UserBitShared.RecordBatchDef; -import org.apache.drill.exec.proto.UserBitShared.RecordBatchDefOrBuilder; import org.apache.drill.exec.proto.UserBitShared.SerializedField; -import java.util.List; +import com.google.common.collect.Lists; public class FragmentWritableBatch{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FragmentWritableBatch.class); - + private static RecordBatchDef EMPTY_DEF = RecordBatchDef.newBuilder().setRecordCount(0).build(); - + private final ByteBuf[] buffers; private final FragmentRecordBatch header; public FragmentWritableBatch(boolean isLast, QueryId queryId, int sendMajorFragmentId, int sendMinorFragmentId, int receiveMajorFragmentId, int receiveMinorFragmentId, WritableBatch batch){ this(isLast, queryId, sendMajorFragmentId, sendMinorFragmentId, receiveMajorFragmentId, receiveMinorFragmentId, batch.getDef(), batch.getBuffers()); } - + private FragmentWritableBatch(boolean isLast, QueryId queryId, int sendMajorFragmentId, int sendMinorFragmentId, int receiveMajorFragmentId, int receiveMinorFragmentId, RecordBatchDef def, ByteBuf... buffers){ this.buffers = buffers; FragmentHandle handle = FragmentHandle // @@ -58,8 +58,8 @@ public class FragmentWritableBatch{ .setSendingMinorFragmentId(sendMinorFragmentId) // .build(); } - - + + public static FragmentWritableBatch getEmptyLast(QueryId queryId, int sendMajorFragmentId, int sendMinorFragmentId, int receiveMajorFragmentId, int receiveMinorFragmentId){ return new FragmentWritableBatch(true, queryId, sendMajorFragmentId, sendMinorFragmentId, receiveMajorFragmentId, receiveMinorFragmentId, EMPTY_DEF); } @@ -78,7 +78,7 @@ public class FragmentWritableBatch{ public ByteBuf[] getBuffers(){ return buffers; } - + public long getByteCount() { long n = 0; for (ByteBuf buf : buffers) { @@ -89,11 +89,11 @@ public class FragmentWritableBatch{ public FragmentRecordBatch getHeader() { return header; - + } - - - - + + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/HyperVectorWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/HyperVectorWrapper.java index b44a23325..7872e081c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/HyperVectorWrapper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/HyperVectorWrapper.java @@ -17,16 +17,14 @@ */ package org.apache.drill.exec.record; -import java.lang.reflect.Array; - -import com.google.common.base.Preconditions; - import org.apache.commons.lang3.ArrayUtils; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.complex.AbstractContainerVector; import org.apache.drill.exec.vector.complex.MapVector; +import com.google.common.base.Preconditions; + public class HyperVectorWrapper<T extends ValueVector> implements VectorWrapper<T>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HyperVectorWrapper.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/MajorTypeSerDe.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/MajorTypeSerDe.java index a080d9604..54e1136c2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/MajorTypeSerDe.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/MajorTypeSerDe.java @@ -39,8 +39,8 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; public class MajorTypeSerDe { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MajorTypeSerDe.class); - - + + public static class De extends StdDeserializer<MajorType> { public De() { @@ -52,11 +52,11 @@ public class MajorTypeSerDe { JsonProcessingException { return jp.readValueAs(MajorTypeHolder.class).getMajorType(); } - - + + } - - + + public static class Se extends StdSerializer<MajorType> { public Se() { @@ -69,9 +69,9 @@ public class MajorTypeSerDe { MajorTypeHolder holder = MajorTypeHolder.get(value); jgen.writeObject(holder); } - + } - + @JsonInclude(Include.NON_NULL) public static class MajorTypeHolder{ @JsonProperty("type") public MinorType minorType; @@ -79,7 +79,7 @@ public class MajorTypeSerDe { public Integer width; public Integer precision; public Integer scale; - + @JsonCreator public MajorTypeHolder(@JsonProperty("type") MinorType minorType, @JsonProperty("mode") DataMode mode, @JsonProperty("width") Integer width, @JsonProperty("precision") Integer precision, @JsonProperty("scale") Integer scale) { super(); @@ -91,7 +91,7 @@ public class MajorTypeSerDe { } private MajorTypeHolder(){} - + @JsonIgnore public MajorType getMajorType(){ MajorType.Builder b = MajorType.newBuilder(); @@ -102,7 +102,7 @@ public class MajorTypeSerDe { if(scale != null) b.setScale(scale); return b.build(); } - + public static MajorTypeHolder get(MajorType mt){ MajorTypeHolder h = new MajorTypeHolder(); h.minorType = mt.getMinorType(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatch.java index dbf17c459..dd0f89af5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatch.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.record; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; import org.apache.drill.exec.proto.BitData.FragmentRecordBatch; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatchProvider.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatchProvider.java index acbd8bd81..d4dfe967f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatchProvider.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatchProvider.java @@ -17,12 +17,12 @@ */ package org.apache.drill.exec.record; -import org.apache.drill.exec.ops.FragmentContext; - import java.io.IOException; +import org.apache.drill.exec.ops.FragmentContext; + public interface RawFragmentBatchProvider { - + public RawFragmentBatch getNext() throws IOException; public void kill(FragmentContext context); public void cleanup(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java index 9b2817983..418957637 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java @@ -21,7 +21,6 @@ import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.record.selection.SelectionVector2; import org.apache.drill.exec.record.selection.SelectionVector4; -import org.apache.drill.exec.vector.ValueVector; /** * A record batch contains a set of field values for a particular range of records. In the case of a record batch @@ -85,9 +84,9 @@ public interface RecordBatch extends VectorAccessible { public abstract SelectionVector4 getSelectionVector4(); - + public VectorContainer getOutgoingContainer(); - + /** * Get the value vector type and id for the given schema path. The TypedFieldId should store a fieldId which is the * same as the ordinal position of the field within the Iterator provided this classes implementation of diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/SchemaBuilder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/SchemaBuilder.java index f4055855f..78214db69 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/SchemaBuilder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/SchemaBuilder.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.record; -import java.util.LinkedHashSet; import java.util.List; import org.apache.drill.exec.exception.SchemaChangeException; @@ -25,7 +24,6 @@ import org.apache.drill.exec.proto.UserBitShared.SerializedField; import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import com.google.common.collect.Lists; -import com.google.common.collect.Sets; /** * A reusable builder that supports the creation of BatchSchemas. Can have a supporting expected object. If the expected Schema object is defined, the @@ -72,7 +70,7 @@ public class SchemaBuilder { } return this; } - + // private void setTypedField(short fieldId, DataType type, boolean nullable, ValueMode mode, Class<?> valueClass) // throws SchemaChangeException { // MaterializedField f = new MaterializedField(fieldId, type, nullable, mode, valueClass); @@ -87,7 +85,7 @@ public class SchemaBuilder { // } // fields.put(f.getFieldId(), f); // } - + public SchemaBuilder addField(MaterializedField f){ fields.add(f); return this; @@ -109,7 +107,7 @@ public class SchemaBuilder { // "not currently contain that field id. The offending fieldId was %d", fieldId)); // setTypedField(fieldId, type, nullable, mode, valueClass); // } - + public SchemaBuilder removeField(MaterializedField f) throws SchemaChangeException{ if(!fields.remove(f)) throw new SchemaChangeException("You attempted to remove an nonexistent field."); return this; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java index 3154e6e1a..acb56d6e8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java @@ -21,7 +21,6 @@ import java.util.Arrays; import org.apache.commons.lang.ArrayUtils; import org.apache.drill.common.expression.PathSegment; -import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.vector.ValueVector; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorAccessible.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorAccessible.java index 474a0a6ea..880099c6f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorAccessible.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorAccessible.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.record; import org.apache.drill.common.expression.SchemaPath; -import org.apache.drill.exec.vector.ValueVector; /** * Created with IntelliJ IDEA. 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 49c739916..ef09f39b2 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 @@ -32,8 +32,8 @@ import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.complex.AbstractMapVector; -import com.google.common.collect.Lists; import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; public class VectorContainer extends AbstractMapVector implements Iterable<VectorWrapper<?>>, VectorAccessible { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VectorContainer.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector2.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector2.java index 104301144..7a7c0123b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector2.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector2.java @@ -99,6 +99,7 @@ public class SelectionVector2 implements Closeable{ return true; } + @Override public SelectionVector2 clone(){ SelectionVector2 newSV = new SelectionVector2(allocator); newSV.recordCount = recordCount; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java index 1433dc66c..fd0932cbd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java @@ -29,7 +29,7 @@ public class SelectionVector4 { private int recordCount; private int start; private int length; - + public SelectionVector4(ByteBuf vector, int recordCount, int batchRecordCount) throws SchemaChangeException { if(recordCount > Integer.MAX_VALUE /4) throw new SchemaChangeException(String.format("Currently, Drill can only support allocations up to 2gb in size. You requested an allocation of %d bytes.", recordCount * 4)); this.recordCount = recordCount; @@ -37,11 +37,11 @@ public class SelectionVector4 { this.length = Math.min(batchRecordCount, recordCount); this.data = vector; } - + public int getTotalCount(){ return recordCount; } - + public int getCount(){ return length; } @@ -57,7 +57,7 @@ public class SelectionVector4 { public void set(int index, int recordBatch, int recordIndex){ data.setInt(index*4, (recordBatch << 16) | (recordIndex & 65535)); } - + public int get(int index){ return data.getInt( (start+index)*4); } @@ -65,7 +65,7 @@ public class SelectionVector4 { /** * Caution: This method shares the underlying buffer between this vector and the newly created one. * @return Newly created single batch SelectionVector4. - * @throws SchemaChangeException + * @throws SchemaChangeException */ public SelectionVector4 createNewWrapperCurrent(){ try { @@ -77,25 +77,25 @@ public class SelectionVector4 { throw new IllegalStateException("This shouldn't happen."); } } - + public boolean next(){ // logger.debug("Next called. Start: {}, Length: {}, recordCount: " + recordCount, start, length); - + if(start + length >= recordCount){ - + start = recordCount; length = 0; // logger.debug("Setting count to zero."); return false; } - + start = start+length; int newEnd = Math.min(start+length, recordCount); length = newEnd - start; // logger.debug("New start {}, new length {}", start, length); return true; } - + public void clear(){ start = 0; length = 0; @@ -104,6 +104,6 @@ public class SelectionVector4 { data = DeadBuf.DEAD_BUFFER; } } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4Builder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4Builder.java index 98e10ed88..8de9948a3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4Builder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4Builder.java @@ -27,28 +27,28 @@ import com.google.common.collect.Lists; public class SelectionVector4Builder { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SelectionVector4Builder.class); - + private List<BatchSchema> schemas = Lists.newArrayList(); - + public void add(RecordBatch batch, boolean newSchema) throws SchemaChangeException{ if(!schemas.isEmpty() && newSchema) throw new SchemaChangeException("Currently, the sv4 builder doesn't support embedded types"); if(newSchema){ schemas.add(batch.getSchema()); } - + } - - + + // deals with managing selection vectors. // take a four byte int /** * take a four byte value * use the first two as a pointer. use the other two as a - * + * * we should manage an array of valuevectors */ - + private class VectorSchemaBuilder{ - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java index a461a5544..9f02d74c9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java @@ -27,7 +27,7 @@ public class DefaultFunctionResolver implements FunctionResolver { @Override public DrillFuncHolder getBestMatch(List<DrillFuncHolder> methods,FunctionCall call) { - + int bestcost = Integer.MAX_VALUE; int currcost = Integer.MAX_VALUE; DrillFuncHolder bestmatch = null; @@ -35,7 +35,7 @@ public class DefaultFunctionResolver implements FunctionResolver { for (DrillFuncHolder h : methods) { currcost = TypeCastRules.getCost(call, h); - + // if cost is lower than 0, func implementation is not matched, either w/ or w/o implicit casts if (currcost < 0 ){ continue; @@ -46,7 +46,7 @@ public class DefaultFunctionResolver implements FunctionResolver { bestmatch = h; } } - + if (bestcost < 0) { //did not find a matched func implementation, either w/ or w/o implicit casts //TODO: raise exception here? @@ -54,5 +54,5 @@ public class DefaultFunctionResolver implements FunctionResolver { } else return bestmatch; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolver.java index b2d576b91..2bd80a5bd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolver.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolver.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.drill.common.expression.FunctionCall; import org.apache.drill.exec.expr.fn.DrillFuncHolder; -public interface FunctionResolver { +public interface FunctionResolver { public DrillFuncHolder getBestMatch(List<DrillFuncHolder> methods, FunctionCall call); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolverFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolverFactory.java index a710e44b3..fa5a3ce4b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolverFactory.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolverFactory.java @@ -21,7 +21,7 @@ package org.apache.drill.exec.resolver; import org.apache.drill.common.expression.FunctionCall; public class FunctionResolverFactory { - + public static FunctionResolver getResolver(FunctionCall call){ return new DefaultFunctionResolver(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/ResolverTypePrecedence.java b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/ResolverTypePrecedence.java index 68a164383..838c49c13 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/ResolverTypePrecedence.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/ResolverTypePrecedence.java @@ -23,25 +23,24 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MinorType; public class ResolverTypePrecedence { - + public static final Map<MinorType, Integer> precedenceMap; public static final Map<MinorType, Set<MinorType>> secondaryImplicitCastRules; public static int MAX_IMPLICIT_CAST_COST; - static { - /* The precedenceMap is used to decide whether it's allowed to implicitly "promote" - * one type to another type. - * - * The order that each type is inserted into HASHMAP decides its precedence. - * First in ==> lowest precedence. + static { + /* The precedenceMap is used to decide whether it's allowed to implicitly "promote" + * one type to another type. + * + * The order that each type is inserted into HASHMAP decides its precedence. + * First in ==> lowest precedence. * A type of lower precedence can be implicitly "promoted" to type of higher precedence. - * For instance, NULL could be promoted to any other type; - * tinyint could be promoted into int; but int could NOT be promoted into tinyint (due to possible precision loss). + * For instance, NULL could be promoted to any other type; + * tinyint could be promoted into int; but int could NOT be promoted into tinyint (due to possible precision loss). */ int i = 0; precedenceMap = new HashMap<MinorType, Integer>(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java index 93f5b6df9..d1ed95e6f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java @@ -26,7 +26,6 @@ import java.util.Set; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.expression.FunctionCall; -import org.apache.drill.common.types.Types; import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractHandshakeHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractHandshakeHandler.java index 56267dfb5..78e4c1024 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractHandshakeHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractHandshakeHandler.java @@ -39,7 +39,7 @@ public abstract class AbstractHandshakeHandler<T extends MessageLite> extends Me this.parser = parser; } - + @Override protected void decode(ChannelHandlerContext ctx, InboundRpcMessage inbound, List<Object> outputs) throws Exception { if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Received handshake {}", inbound); @@ -48,12 +48,12 @@ public abstract class AbstractHandshakeHandler<T extends MessageLite> extends Me if (inbound.rpcType != handshakeType.getNumber()) throw new RpcException(String.format("Handshake failure. Expected %s[%d] but received number [%d]", handshakeType, handshakeType.getNumber(), inbound.rpcType)); - + T msg = parser.parseFrom(inbound.getProtobufBodyAsIS()); consumeHandshake(ctx, msg); inbound.pBody.release(); if(inbound.dBody != null) inbound.dBody.release(); - + } protected abstract void consumeHandshake(ChannelHandlerContext ctx, T msg) throws Exception; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Acks.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Acks.java index 8429fb1f6..365671770 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Acks.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Acks.java @@ -21,7 +21,7 @@ import org.apache.drill.exec.proto.GeneralRPCProtos.Ack; public class Acks { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Acks.class); - + public static final Ack OK = Ack.newBuilder().setOk(true).build(); public static final Ack FAIL = Ack.newBuilder().setOk(false).build(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BaseRpcOutcomeListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BaseRpcOutcomeListener.java index fd4dd18c4..10ae6e3a8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BaseRpcOutcomeListener.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BaseRpcOutcomeListener.java @@ -29,6 +29,6 @@ public class BaseRpcOutcomeListener<T> implements RpcOutcomeListener<T> { @Override public void success(T value, ByteBuf buffer) { } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClient.java index 3dc90b910..f358097cb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClient.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClient.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.rpc; -import java.util.concurrent.ExecutionException; - import io.netty.bootstrap.Bootstrap; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; @@ -28,11 +26,11 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; -import io.netty.channel.epoll.EpollChannelOption; import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.util.concurrent.GenericFutureListener; +import java.util.concurrent.ExecutionException; + import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.rpc.RpcConnectionHandler.FailureType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClientWithConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClientWithConnection.java index d50a64e64..08819ca8d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClientWithConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClientWithConnection.java @@ -35,13 +35,13 @@ public abstract class BasicClientWithConnection<T extends EnumLite, HANDSHAKE_SE static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BasicClientWithConnection.class); private BufferAllocator alloc; - + public BasicClientWithConnection(RpcConfig rpcMapping, BufferAllocator alloc, EventLoopGroup eventLoopGroup, T handshakeType, Class<HANDSHAKE_RESPONSE> responseClass, Parser<HANDSHAKE_RESPONSE> handshakeParser) { super(rpcMapping, alloc.getUnderlyingAllocator(), eventLoopGroup, handshakeType, responseClass, handshakeParser); this.alloc = alloc; } - + @Override protected GenericFutureListener<ChannelFuture> getCloseHandler(ServerConnection clientConnection) { return getCloseHandler(clientConnection.getChannel()); @@ -51,9 +51,9 @@ public abstract class BasicClientWithConnection<T extends EnumLite, HANDSHAKE_SE protected Response handle(ServerConnection connection, int rpcType, ByteBuf pBody, ByteBuf dBody) throws RpcException { return handleReponse( (ConnectionThrottle) connection, rpcType, pBody, dBody); } - + protected abstract Response handleReponse(ConnectionThrottle throttle, int rpcType, ByteBuf pBody, ByteBuf dBody) throws RpcException ; - + @Override public ServerConnection initRemoteConnection(Channel channel) { return new ServerConnection(channel, alloc); @@ -62,7 +62,7 @@ public abstract class BasicClientWithConnection<T extends EnumLite, HANDSHAKE_SE public static class ServerConnection extends RemoteConnection{ private final BufferAllocator alloc; - + public ServerConnection(Channel channel, BufferAllocator alloc) { super(channel); this.alloc = alloc; @@ -72,10 +72,10 @@ public abstract class BasicClientWithConnection<T extends EnumLite, HANDSHAKE_SE public BufferAllocator getAllocator() { return alloc; } - - + + } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicServer.java index b08685b7e..c00df4e6e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicServer.java @@ -25,11 +25,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; -import io.netty.channel.epoll.EpollChannelOption; -import io.netty.channel.epoll.EpollServerSocketChannel; -import io.netty.channel.socket.ServerSocketChannel; import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioServerSocketChannel; import java.io.IOException; import java.net.BindException; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ChannelClosedException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ChannelClosedException.java index 20994c29c..b68efae29 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ChannelClosedException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ChannelClosedException.java @@ -35,5 +35,5 @@ public class ChannelClosedException extends RpcException{ public ChannelClosedException(Throwable cause) { super(cause); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/CoordinationQueue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/CoordinationQueue.java index 2bce738dd..f7b396990 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/CoordinationQueue.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/CoordinationQueue.java @@ -44,7 +44,7 @@ public class CoordinationQueue { if(ex instanceof RpcException){ e = (RpcException) ex; }else{ - e = new RpcException(ex); + e = new RpcException(ex); } for (RpcOutcome<?> f : map.values()) { f.setException(e); @@ -61,13 +61,13 @@ public class CoordinationQueue { "You attempted to reuse a coordination id when the previous coordination id has not been removed. This is likely rpc future callback memory leak."); return future; } - + private class RpcListener<T> implements ChannelListenerWithCoordinationId, RpcOutcome<T>{ final RpcOutcomeListener<T> handler; final Class<T> clazz; final int coordinationId; final RemoteConnection connection; - + public RpcListener(RpcOutcomeListener<T> handler, Class<T> clazz, int coordinationId, RemoteConnection connection) { super(); this.handler = handler; @@ -110,8 +110,8 @@ public class CoordinationQueue { public int getCoordinationId() { return coordinationId; } - - + + } private RpcOutcome<?> removeFromMap(int coordinationId) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFuture.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFuture.java index d9696041e..d044432f3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFuture.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFuture.java @@ -23,6 +23,6 @@ import com.google.common.util.concurrent.CheckedFuture; public interface DrillRpcFuture<T> extends CheckedFuture<T,RpcException> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillRpcFuture.class); - + public ByteBuf getBuffer(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFutureImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFutureImpl.java index e87ed18c3..291c71a99 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFutureImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFutureImpl.java @@ -24,13 +24,13 @@ import com.google.common.util.concurrent.AbstractFuture; class DrillRpcFutureImpl<V> extends AbstractCheckedFuture<V, RpcException> implements DrillRpcFuture<V>, RpcOutcomeListener<V>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillRpcFutureImpl.class); - + private volatile ByteBuf buffer; - + public DrillRpcFutureImpl() { super(new InnerFuture<V>()); } - + /** * Drill doesn't currently support rpc cancellations since nearly all requests should be either instance of * asynchronous. Business level cancellation is managed a separate call (e.g. canceling a query.). Calling this method @@ -54,6 +54,7 @@ class DrillRpcFutureImpl<V> extends AbstractCheckedFuture<V, RpcException> imple super.set(value); } + @Override protected boolean setException(Throwable t) { return super.setException(t); } @@ -79,6 +80,6 @@ class DrillRpcFutureImpl<V> extends AbstractCheckedFuture<V, RpcException> imple if(buffer != null) buffer.release(); } - - + + }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/FutureBitCommand.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/FutureBitCommand.java index fe5d12db9..6c7bf3e56 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/FutureBitCommand.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/FutureBitCommand.java @@ -37,7 +37,7 @@ public abstract class FutureBitCommand<T extends MessageLite, C extends RemoteCo @Override public void connectionAvailable(C connection) { - + doRpcCall(new DeferredRpcOutcome(), connection); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/InboundRpcMessage.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/InboundRpcMessage.java index 8fc446fd4..012b9e4c1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/InboundRpcMessage.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/InboundRpcMessage.java @@ -27,19 +27,21 @@ import org.apache.drill.exec.proto.GeneralRPCProtos.RpcMode; public class InboundRpcMessage extends RpcMessage{ public ByteBuf pBody; public ByteBuf dBody; - + public InboundRpcMessage(RpcMode mode, int rpcType, int coordinationId, ByteBuf pBody, ByteBuf dBody) { super(mode, rpcType, coordinationId); this.pBody = pBody; this.dBody = dBody; } - + + @Override public int getBodySize(){ int len = pBody.capacity(); if(dBody != null) len += dBody.capacity(); return len; } - + + @Override void release(){ if (pBody != null) pBody.release(); if(dBody != null) dBody.release(); @@ -50,7 +52,7 @@ public class InboundRpcMessage extends RpcMessage{ return "InboundRpcMessage [pBody=" + pBody + ", mode=" + mode + ", rpcType=" + rpcType + ", coordinationId=" + coordinationId + ", dBody=" + dBody + "]"; } - + public InputStream getProtobufBodyAsIS(){ return new ByteBufInputStream(pBody); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ListeningCommand.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ListeningCommand.java index acb696c54..e32ca8a33 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ListeningCommand.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ListeningCommand.java @@ -34,7 +34,7 @@ public abstract class ListeningCommand<T extends MessageLite, C extends RemoteCo @Override public void connectionAvailable(C connection) { - + doRpcCall(new DeferredRpcOutcome(), connection); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/OutboundRpcMessage.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/OutboundRpcMessage.java index a4c5ef910..ef966cbcb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/OutboundRpcMessage.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/OutboundRpcMessage.java @@ -37,7 +37,7 @@ public class OutboundRpcMessage extends RpcMessage { public OutboundRpcMessage(RpcMode mode, EnumLite rpcType, int coordinationId, MessageLite pBody, ByteBuf... dBodies) { super(mode, rpcType.getNumber(), coordinationId); this.pBody = pBody; - + // Netty doesn't traditionally release the reference on an unreadable buffer. However, we need to so that if we send a empty or unwritable buffer, we still release. otherwise we get weird memory leaks when sending empty vectors. List<ByteBuf> bufs = Lists.newArrayList(); for(ByteBuf d : dBodies){ @@ -50,6 +50,7 @@ public class OutboundRpcMessage extends RpcMessage { this.dBodies = bufs.toArray(new ByteBuf[bufs.size()]); } + @Override public int getBodySize() { int len = pBody.getSerializedSize(); len += RpcEncoder.getRawVarintSize(len); @@ -60,20 +61,21 @@ public class OutboundRpcMessage extends RpcMessage { public int getRawBodySize(){ if(dBodies == null) return 0; int len = 0; - + for (int i = 0; i < dBodies.length; i++) { if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Reader Index {}, Writer Index {}", dBodies[i].readerIndex(), dBodies[i].writerIndex()); len += dBodies[i].readableBytes(); } return len; } - + @Override public String toString() { return "OutboundRpcMessage [pBody=" + pBody + ", mode=" + mode + ", rpcType=" + rpcType + ", coordinationId=" + coordinationId + ", dBodies=" + Arrays.toString(dBodies) + "]"; } - + + @Override void release(){ if(dBodies != null){ for(ByteBuf b : dBodies){ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/PositiveAtomicInteger.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/PositiveAtomicInteger.java index 1b3264698..401663d73 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/PositiveAtomicInteger.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/PositiveAtomicInteger.java @@ -24,9 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class PositiveAtomicInteger { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PositiveAtomicInteger.class); - + private final AtomicInteger internal = new AtomicInteger(0); - + public int getNext(){ int i = internal.addAndGet(1); if(i < 0){ @@ -35,5 +35,5 @@ public class PositiveAtomicInteger { return i; } } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ReconnectingConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ReconnectingConnection.java index 4cd41558f..1675b521f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ReconnectingConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ReconnectingConnection.java @@ -72,7 +72,7 @@ public abstract class ReconnectingConnection<CONNECTION_TYPE extends RemoteConne connection = connectionHolder.get(); if (connection != null) { cmd.connectionAvailable(connection); - + } else { // logger.debug("No connection active, opening client connection."); BasicClient<?, CONNECTION_TYPE, OUTBOUND_HANDSHAKE, ?> client = getNewClient(); @@ -145,7 +145,7 @@ public abstract class ReconnectingConnection<CONNECTION_TYPE extends RemoteConne incoming.getChannel().close(); } set(connection); - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteConnection.java index cc3ec699f..3a139f8a3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteConnection.java @@ -17,12 +17,12 @@ */ package org.apache.drill.exec.rpc; -import java.util.concurrent.ExecutionException; - import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; +import java.util.concurrent.ExecutionException; + import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.rpc.user.ConnectionThrottle; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteRpcException.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteRpcException.java index af1316c8f..d75e902bb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteRpcException.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RemoteRpcException.java @@ -21,7 +21,7 @@ import org.apache.drill.exec.proto.GeneralRPCProtos.RpcFailure; public class RemoteRpcException extends RpcException{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RemoteRpcException.class); - + private final RpcFailure failure; public RemoteRpcException(RpcFailure failure) { @@ -32,7 +32,7 @@ public class RemoteRpcException extends RpcException{ public RpcFailure getFailure() { return failure; } - - - + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ResettableBarrier.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ResettableBarrier.java index a19b75391..615bccc5c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ResettableBarrier.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ResettableBarrier.java @@ -37,11 +37,13 @@ public class ResettableBarrier { setState(1); } + @Override protected int tryAcquireShared(int acquires) { assert acquires == 1; return (getState() == 0) ? 1 : -1; } + @Override protected boolean tryReleaseShared(int releases) { assert releases == 1; @@ -76,7 +78,7 @@ public class ResettableBarrier { // logger.debug("opening barrier."); sync.releaseShared(1); } - + public void closeBarrier(){ // logger.debug("closing barrier."); sync.reset(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Response.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Response.java index 12b73a8ce..b48adec01 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Response.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Response.java @@ -24,19 +24,19 @@ import com.google.protobuf.MessageLite; public class Response { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Response.class); - + public EnumLite rpcType; public MessageLite pBody; public ByteBuf[] dBodies; - + public Response(EnumLite rpcType, MessageLite pBody, ByteBuf... dBodies) { super(); this.rpcType = rpcType; this.pBody = pBody; this.dBodies = dBodies; } - - - - + + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcBus.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcBus.java index 05cca5a5f..c6979e5b1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcBus.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcBus.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.rpc; -import com.google.common.base.Stopwatch; - import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufInputStream; import io.netty.channel.Channel; @@ -31,9 +29,7 @@ import io.netty.util.concurrent.GenericFutureListener; import java.io.Closeable; import java.util.Arrays; import java.util.List; -import java.util.concurrent.TimeUnit; -import org.apache.drill.exec.proto.BitControl; import org.apache.drill.exec.proto.GeneralRPCProtos.RpcFailure; import org.apache.drill.exec.proto.GeneralRPCProtos.RpcMode; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCheckedFuture.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCheckedFuture.java index 8434ba933..11b07ad88 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCheckedFuture.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCheckedFuture.java @@ -23,9 +23,9 @@ import com.google.common.util.concurrent.AbstractCheckedFuture; import com.google.common.util.concurrent.ListenableFuture; public class RpcCheckedFuture<T> extends AbstractCheckedFuture<T, RpcException> implements DrillRpcFuture<T>{ - + volatile ByteBuf buffer; - + public RpcCheckedFuture(ListenableFuture<T> delegate) { super(delegate); } @@ -33,7 +33,7 @@ public class RpcCheckedFuture<T> extends AbstractCheckedFuture<T, RpcException> public void set(T obj, ByteBuf buffer){ this.buffer = buffer; } - + @Override protected RpcException mapException(Exception e) { return RpcException.mapException(e); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCommand.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCommand.java index 952317771..93b901c56 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCommand.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcCommand.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.rpc; -import org.apache.drill.exec.rpc.RpcConnectionHandler; - import com.google.protobuf.MessageLite; public interface RpcCommand<T extends MessageLite, C extends RemoteConnection> extends RpcConnectionHandler<C>{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConfig.java index 6ab121e54..3010f2b7b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConfig.java @@ -30,13 +30,13 @@ public class RpcConfig { private final String name; private final Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap; private final Map<Integer, RpcMessageType<?, ?, ?>> receiveMap; - + private RpcConfig(String name, Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap, Map<Integer, RpcMessageType<?, ?, ?>> receiveMap){ this.name = name; this.sendMap = ImmutableMap.copyOf(sendMap); this.receiveMap = ImmutableMap.copyOf(receiveMap); } - + public String getName() { return name; } @@ -51,7 +51,7 @@ public class RpcConfig { } return true; } - + public boolean checkSend(EnumLite send, Class<?> sendClass, Class<?> receiveClass){ if(RpcConstants.EXTRA_DEBUGGING) logger.debug(String.format("Checking send classes for send RpcType %s. Send Class is %s and Receive class is %s.", send, sendClass, receiveClass)); RpcMessageType<?,?,?> type = sendMap.get(send); @@ -62,16 +62,16 @@ public class RpcConfig { return true; } - + public boolean checkResponseSend(EnumLite responseType, Class<?> responseClass){ if(RpcConstants.EXTRA_DEBUGGING) logger.debug(String.format("Checking responce send of type %s with response class of %s.", responseType, responseClass)); RpcMessageType<?,?,?> type = receiveMap.get(responseType.getNumber()); if(type == null) throw new IllegalStateException(String.format("%s: There is no defined RpcMessage type for a Rpc response of type %s.", name, responseType)); if(type.getRet() != responseClass) throw new IllegalStateException(String.format("%s: The definition for the response doesn't match implementation code. The definition is %s however the current response is trying to response with an object of type %s.", name, type, responseClass.getCanonicalName())); - + return true; } - + public static class RpcMessageType<SEND extends MessageLite, RECEIVE extends MessageLite, T extends EnumLite>{ private T sendEnum; private Class<SEND> send; @@ -113,37 +113,37 @@ public class RpcConfig { return "RpcMessageType [sendEnum=" + sendEnum + ", send=" + send + ", receiveEnum=" + receiveEnum + ", ret=" + ret + "]"; } - - + + } public static RpcConfigBuilder newBuilder(String name){ return new RpcConfigBuilder(name); } - + public static class RpcConfigBuilder { private final String name; private Map<EnumLite, RpcMessageType<?, ?, ?>> sendMap = Maps.newHashMap(); - private Map<Integer, RpcMessageType<?, ?, ?>> receiveMap = Maps.newHashMap(); - + private Map<Integer, RpcMessageType<?, ?, ?>> receiveMap = Maps.newHashMap(); + private RpcConfigBuilder(String name){ this.name = name; } - + public <SEND extends MessageLite, RECEIVE extends MessageLite, T extends EnumLite> RpcConfigBuilder add(T sendEnum, Class<SEND> send, T receiveEnum, Class<RECEIVE> rec){ RpcMessageType<SEND, RECEIVE, T> type = new RpcMessageType<SEND, RECEIVE, T>(sendEnum, send, receiveEnum, rec); this.sendMap.put(sendEnum, type); this.receiveMap.put(receiveEnum.getNumber(), type); return this; } - + public RpcConfig build(){ return new RpcConfig(name, sendMap, receiveMap); } } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConnectionHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConnectionHandler.java index bcec2d4f2..76182317f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConnectionHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConnectionHandler.java @@ -19,10 +19,10 @@ package org.apache.drill.exec.rpc; public interface RpcConnectionHandler<T extends RemoteConnection> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RpcConnectionHandler.class); - + public static enum FailureType{CONNECTION, HANDSHAKE_COMMUNICATION, HANDSHAKE_VALIDATION} - + public void connectionSucceeded(T connection); public void connectionFailed(FailureType type, Throwable t); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConstants.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConstants.java index b1ae932ff..4be365cb3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConstants.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcConstants.java @@ -19,9 +19,9 @@ package org.apache.drill.exec.rpc; public class RpcConstants { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RpcConstants.class); - + private RpcConstants(){} - + public static final boolean SOME_DEBUGGING = false; public static final boolean EXTRA_DEBUGGING = false; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcDecoder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcDecoder.java index abddcb36a..f4fe64db0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcDecoder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcDecoder.java @@ -34,20 +34,20 @@ import org.apache.drill.exec.proto.GeneralRPCProtos.RpcHeader; */ class RpcDecoder extends MessageToMessageDecoder<ByteBuf> { final org.slf4j.Logger logger; - + private final AtomicLong messageCounter = new AtomicLong(); - + public RpcDecoder(String name){ this.logger = org.slf4j.LoggerFactory.getLogger(RpcDecoder.class.getCanonicalName() + "-" + name); } - + @Override protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception { if(!ctx.channel().isOpen()){ return; } - + if (RpcConstants.EXTRA_DEBUGGING) logger.debug("Inbound rpc message received."); // now, we know the entire message is in the buffer and the buffer is constrained to this message. Additionally, @@ -60,7 +60,7 @@ class RpcDecoder extends MessageToMessageDecoder<ByteBuf> { final RpcHeader header = RpcHeader.parseDelimitedFrom(is); if(RpcConstants.EXTRA_DEBUGGING) logger.debug(" post header read index {}", buffer.readerIndex()); - + // read the protobuf body into a buffer. checkTag(is, RpcEncoder.PROTOBUF_BODY_TAG); final int pBodyLength = readRawVarint32(is); @@ -70,13 +70,13 @@ class RpcDecoder extends MessageToMessageDecoder<ByteBuf> { if (RpcConstants.EXTRA_DEBUGGING) logger.debug("Read protobuf body of length {} into buffer {}.", pBodyLength, pBody); if(RpcConstants.EXTRA_DEBUGGING) logger.debug("post protobufbody read index {}", buffer.readerIndex()); - + ByteBuf dBody = null; int dBodyLength = 0; // read the data body. if (buffer.readableBytes() > 0) { - + if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Reading raw body, buffer has {} bytes available, is available {}.", buffer.readableBytes(), is.available()); checkTag(is, RpcEncoder.RAW_BODY_TAG); dBodyLength = readRawVarint32(is); @@ -84,7 +84,7 @@ class RpcDecoder extends MessageToMessageDecoder<ByteBuf> { dBody = buffer.slice(); dBody.retain(); if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Read raw body of {}", dBody); - + }else{ if(RpcConstants.EXTRA_DEBUGGING) logger.debug("No need to read raw body, no readable bytes left."); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcEncoder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcEncoder.java index 9c3f5ca35..8bf3483e1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcEncoder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcEncoder.java @@ -29,7 +29,6 @@ import java.util.List; import org.apache.drill.exec.proto.GeneralRPCProtos.CompleteRpcMessage; import org.apache.drill.exec.proto.GeneralRPCProtos.RpcHeader; -import com.google.common.base.Preconditions; import com.google.protobuf.CodedOutputStream; import com.google.protobuf.WireFormat; @@ -38,36 +37,36 @@ import com.google.protobuf.WireFormat; */ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ final org.slf4j.Logger logger; - + static final int HEADER_TAG = makeTag(CompleteRpcMessage.HEADER_FIELD_NUMBER, WireFormat.WIRETYPE_LENGTH_DELIMITED); static final int PROTOBUF_BODY_TAG = makeTag(CompleteRpcMessage.PROTOBUF_BODY_FIELD_NUMBER, WireFormat.WIRETYPE_LENGTH_DELIMITED); static final int RAW_BODY_TAG = makeTag(CompleteRpcMessage.RAW_BODY_FIELD_NUMBER, WireFormat.WIRETYPE_LENGTH_DELIMITED); static final int HEADER_TAG_LENGTH = getRawVarintSize(HEADER_TAG); static final int PROTOBUF_BODY_TAG_LENGTH = getRawVarintSize(PROTOBUF_BODY_TAG); static final int RAW_BODY_TAG_LENGTH = getRawVarintSize(RAW_BODY_TAG); - + public RpcEncoder(String name){ this.logger = org.slf4j.LoggerFactory.getLogger(RpcEncoder.class.getCanonicalName() + "-" + name); } - + @Override protected void encode(ChannelHandlerContext ctx, OutboundRpcMessage msg, List<Object> out) throws Exception { if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Rpc Encoder called with msg {}", msg); - + if(!ctx.channel().isOpen()){ //output.add(ctx.alloc().buffer(0)); logger.debug("Channel closed, skipping encode."); return; } - + try{ if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Encoding outbound message {}", msg); - // first we build the RpcHeader + // first we build the RpcHeader RpcHeader header = RpcHeader.newBuilder() // .setMode(msg.mode) // .setCoordinationId(msg.coordinationId) // .setRpcType(msg.rpcType).build(); - + // figure out the full length int headerLength = header.getSerializedSize(); int protoBodyLength = msg.pBody.getSerializedSize(); @@ -75,7 +74,7 @@ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ int fullLength = // HEADER_TAG_LENGTH + getRawVarintSize(headerLength) + headerLength + // PROTOBUF_BODY_TAG_LENGTH + getRawVarintSize(protoBodyLength) + protoBodyLength; // - + if(rawBodyLength > 0){ fullLength += (RAW_BODY_TAG_LENGTH + getRawVarintSize(rawBodyLength) + rawBodyLength); } @@ -86,7 +85,7 @@ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ // write full length first (this is length delimited stream). cos.writeRawVarint32(fullLength); - + // write header cos.writeRawVarint32(HEADER_TAG); cos.writeRawVarint32(headerLength); @@ -96,15 +95,15 @@ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ cos.writeRawVarint32(PROTOBUF_BODY_TAG); cos.writeRawVarint32(protoBodyLength); msg.pBody.writeTo(cos); - + // if exists, write data body and tag. if(msg.getRawBodySize() > 0){ if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Writing raw body of size {}", msg.getRawBodySize()); - + cos.writeRawVarint32(RAW_BODY_TAG); cos.writeRawVarint32(rawBodyLength); cos.flush(); // need to flush so that dbody goes after if cos is caching. - + CompositeByteBuf cbb = new CompositeByteBuf(buf.alloc(), true, msg.dBodies.length + 1); cbb.addComponent(buf); int bufLength = buf.readableBytes(); @@ -114,27 +113,27 @@ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ } cbb.writerIndex(bufLength); out.add(cbb); - - + + }else{ cos.flush(); out.add(buf); } - + if(RpcConstants.SOME_DEBUGGING) logger.debug("Wrote message length {}:{} bytes (head:body). Message: " + msg, getRawVarintSize(fullLength), fullLength); if(RpcConstants.EXTRA_DEBUGGING) logger.debug("Sent message. Ending writer index was {}.", buf.writerIndex()); - + }finally{ // make sure to release Rpc Messages underlying byte buffers. //msg.release(); } } - + /** Makes a tag value given a field number and wire type, copied from WireFormat since it isn't public. */ static int makeTag(final int fieldNumber, final int wireType) { return (fieldNumber << 3) | wireType; } - + public static int getRawVarintSize(int value) { int count = 0; while (true) { @@ -147,5 +146,5 @@ class RpcEncoder extends MessageToMessageEncoder<OutboundRpcMessage>{ } } } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcExceptionHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcExceptionHandler.java index ee42ee558..537452e92 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcExceptionHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcExceptionHandler.java @@ -22,14 +22,14 @@ import io.netty.channel.ChannelHandlerContext; public class RpcExceptionHandler implements ChannelHandler{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RpcExceptionHandler.class); - + public RpcExceptionHandler(){ } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - + if(!ctx.channel().isOpen() || cause.getMessage().equals("Connection reset by peer")){ logger.warn("Exception with closed channel", cause); return; @@ -48,5 +48,5 @@ public class RpcExceptionHandler implements ChannelHandler{ @Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcMessage.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcMessage.java index 7f97e27a2..9712c9a83 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcMessage.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcMessage.java @@ -17,24 +17,22 @@ */ package org.apache.drill.exec.rpc; -import io.netty.buffer.ByteBuf; - import org.apache.drill.exec.proto.GeneralRPCProtos.RpcMode; public abstract class RpcMessage { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RpcMessage.class); - + public RpcMode mode; public int rpcType; public int coordinationId; - + public RpcMessage(RpcMode mode, int rpcType, int coordinationId) { this.mode = mode; this.rpcType = rpcType; this.coordinationId = coordinationId; } - + public abstract int getBodySize(); abstract void release(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcome.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcome.java index c60d1df27..af9aa0142 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcome.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcome.java @@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf; public interface RpcOutcome<T> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RpcOutcome.class); - + public void set(Object value, ByteBuf buffer); public void setException(Throwable t); public Class<T> getOutcomeType(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcomeListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcomeListener.java index a4bf2c28f..7d7c8601e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcomeListener.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/RpcOutcomeListener.java @@ -20,10 +20,10 @@ package org.apache.drill.exec.rpc; import io.netty.buffer.ByteBuf; public interface RpcOutcomeListener<V> { - + public void failed(RpcException ex); public void success(V value, ByteBuf buffer); - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ConnectionManagerRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ConnectionManagerRegistry.java index 649dc09ff..37c9ce2d0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ConnectionManagerRegistry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ConnectionManagerRegistry.java @@ -28,13 +28,13 @@ import com.google.common.collect.Maps; public class ConnectionManagerRegistry implements Iterable<ControlConnectionManager>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ConnectionManagerRegistry.class); - + private final ConcurrentMap<DrillbitEndpoint, ControlConnectionManager> registry = Maps.newConcurrentMap(); - + private final ControlMessageHandler handler; private final BootStrapContext context; private volatile DrillbitEndpoint localEndpoint; - + public ConnectionManagerRegistry(ControlMessageHandler handler, BootStrapContext context) { super(); this.handler = handler; @@ -49,7 +49,7 @@ public class ConnectionManagerRegistry implements Iterable<ControlConnectionMana ControlConnectionManager m2 = registry.putIfAbsent(endpoint, m); if(m2 != null) m = m2; } - + return m; } @@ -57,9 +57,9 @@ public class ConnectionManagerRegistry implements Iterable<ControlConnectionMana public Iterator<ControlConnectionManager> iterator() { return registry.values().iterator(); } - + public void setEndpoint(DrillbitEndpoint endpoint){ this.localEndpoint = endpoint; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlClient.java index 84595c69d..879df40f6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlClient.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlClient.java @@ -48,7 +48,7 @@ public class ControlClient extends BasicClient<RpcType, ControlConnection, BitCo private final ControlConnectionManager.CloseHandlerCreator closeHandlerFactory; private final DrillbitEndpoint localIdentity; private final BufferAllocator allocator; - + public ControlClient(DrillbitEndpoint remoteEndpoint, DrillbitEndpoint localEndpoint, ControlMessageHandler handler, BootStrapContext context, ControlConnectionManager.CloseHandlerCreator closeHandlerFactory) { super(ControlRpcConfig.MAPPING, context.getAllocator().getUnderlyingAllocator(), context.getBitLoopGroup(), RpcType.HANDSHAKE, BitControlHandshake.class, BitControlHandshake.PARSER); this.localIdentity = localEndpoint; @@ -57,7 +57,7 @@ public class ControlClient extends BasicClient<RpcType, ControlConnection, BitCo this.closeHandlerFactory = closeHandlerFactory; this.allocator = context.getAllocator(); } - + public void connect(RpcConnectionHandler<ControlConnection> connectionHandler) { connectAsClient(connectionHandler, BitControlHandshake.newBuilder().setRpcVersion(ControlRpcConfig.RPC_VERSION).setEndpoint(localIdentity).build(), remoteEndpoint.getAddress(), remoteEndpoint.getControlPort()); } @@ -102,5 +102,5 @@ public class ControlClient extends BasicClient<RpcType, ControlConnection, BitCo public ProtobufLengthDecoder getDecoder(BufferAllocator allocator) { return new ControlProtobufLengthDecoder(allocator, OutOfMemoryHandler.DEFAULT_INSTANCE); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java index c03b7c245..6ac6dd553 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnection.java @@ -72,6 +72,7 @@ public class ControlConnection extends RemoteConnection { active = false; } + @Override public boolean isActive() { return active; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnectionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnectionManager.java index f3274a973..60af2a90a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnectionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlConnectionManager.java @@ -29,12 +29,12 @@ import org.apache.drill.exec.work.batch.ControlMessageHandler; */ public class ControlConnectionManager extends ReconnectingConnection<ControlConnection, BitControlHandshake>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ControlConnectionManager.class); - + private final DrillbitEndpoint endpoint; private final ControlMessageHandler handler; private final BootStrapContext context; private final DrillbitEndpoint localIdentity; - + public ControlConnectionManager(DrillbitEndpoint remoteEndpoint, DrillbitEndpoint localIdentity, ControlMessageHandler handler, BootStrapContext context) { super(BitControlHandshake.newBuilder().setRpcVersion(ControlRpcConfig.RPC_VERSION).setEndpoint(localIdentity).build(), remoteEndpoint.getAddress(), remoteEndpoint.getControlPort()); assert remoteEndpoint != null : "Endpoint cannot be null."; @@ -52,9 +52,9 @@ public class ControlConnectionManager extends ReconnectingConnection<ControlConn return new ControlClient(endpoint, localIdentity, handler, context, new CloseHandlerCreator()); } - + public DrillbitEndpoint getEndpoint() { return endpoint; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlProtobufLengthDecoder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlProtobufLengthDecoder.java index 7edfe204e..36573b53e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlProtobufLengthDecoder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlProtobufLengthDecoder.java @@ -32,8 +32,9 @@ import org.apache.drill.exec.rpc.ProtobufLengthDecoder; public class ControlProtobufLengthDecoder extends ProtobufLengthDecoder{ public ControlProtobufLengthDecoder(BufferAllocator allocator, OutOfMemoryHandler outOfMemoryHandler) { super(allocator, outOfMemoryHandler); - + } + @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { super.decode(ctx, in, out); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java index 9953e5fbd..31fbe7b0a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlRpcConfig.java @@ -33,7 +33,7 @@ import org.apache.drill.exec.rpc.RpcConfig; public class ControlRpcConfig { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ControlRpcConfig.class); - + public static RpcConfig MAPPING = RpcConfig.newBuilder("BIT-CONTROL-RPC-MAPPING") // .add(RpcType.HANDSHAKE, BitControlHandshake.class, RpcType.HANDSHAKE, BitControlHandshake.class) .add(RpcType.REQ_INIATILIZE_FRAGMENT, PlanFragment.class, RpcType.ACK, Ack.class) @@ -42,8 +42,8 @@ public class ControlRpcConfig { .add(RpcType.REQ_FRAGMENT_STATUS, FragmentStatus.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_QUERY_STATUS, QueryId.class, RpcType.RESP_QUERY_STATUS, QueryProfile.class) .build(); - + public static int RPC_VERSION = 2; - + public static final Response OK = new Response(RpcType.ACK, Acks.OK); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlServer.java index fc1d98caa..393773d99 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControlServer.java @@ -37,19 +37,19 @@ import com.google.protobuf.MessageLite; public class ControlServer extends BasicServer<RpcType, ControlConnection>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ControlServer.class); - + private final ControlMessageHandler handler; private final ConnectionManagerRegistry connectionRegistry; private volatile ProxyCloseHandler proxyCloseHandler; private BufferAllocator allocator; - + public ControlServer(ControlMessageHandler handler, BootStrapContext context, ConnectionManagerRegistry connectionRegistry) { super(ControlRpcConfig.MAPPING, context.getAllocator().getUnderlyingAllocator(), context.getBitLoopGroup()); this.handler = handler; this.connectionRegistry = connectionRegistry; this.allocator = context.getAllocator(); } - + @Override public MessageLite getResponseDefaultInstance(int rpcType) throws RpcException { return DefaultInstanceHandler.getResponseDefaultInstance(rpcType); @@ -70,12 +70,12 @@ public class ControlServer extends BasicServer<RpcType, ControlConnection>{ public ControlConnection initRemoteConnection(Channel channel) { return new ControlConnection(channel, this, allocator); } - - + + @Override protected ServerHandshakeHandler<BitControlHandshake> getHandshakeHandler(final ControlConnection connection) { return new ServerHandshakeHandler<BitControlHandshake>(RpcType.HANDSHAKE, BitControlHandshake.PARSER){ - + @Override public MessageLite getHandshakeResponse(BitControlHandshake inbound) throws Exception { // logger.debug("Handling handshake from other bit. {}", inbound); @@ -83,13 +83,13 @@ public class ControlServer extends BasicServer<RpcType, ControlConnection>{ if(!inbound.hasEndpoint() || inbound.getEndpoint().getAddress().isEmpty() || inbound.getEndpoint().getControlPort() < 1) throw new RpcException(String.format("RPC didn't provide valid counter endpoint information. Received %s.", inbound.getEndpoint())); connection.setEndpoint(inbound.getEndpoint()); - // add the + // add the ControlConnectionManager manager = connectionRegistry.getConnectionManager(inbound.getEndpoint()); - + // update the close handler. proxyCloseHandler.setHandler(manager.getCloseHandlerCreator().getHandler(connection, proxyCloseHandler.getHandler())); - - // add to the connection manager. + + // add to the connection manager. manager.addExternalConnection(connection); return BitControlHandshake.newBuilder().setRpcVersion(ControlRpcConfig.RPC_VERSION).build(); @@ -106,7 +106,7 @@ public class ControlServer extends BasicServer<RpcType, ControlConnection>{ private class ProxyCloseHandler implements GenericFutureListener<ChannelFuture> { private volatile GenericFutureListener<ChannelFuture> handler; - + public ProxyCloseHandler(GenericFutureListener<ChannelFuture> handler) { super(); this.handler = handler; @@ -126,8 +126,8 @@ public class ControlServer extends BasicServer<RpcType, ControlConnection>{ public void operationComplete(ChannelFuture future) throws Exception { handler.operationComplete(future); } - + } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java index 9a11c9484..7f84a2b24 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/Controller.java @@ -21,7 +21,6 @@ import java.io.Closeable; import org.apache.drill.exec.exception.DrillbitStartupException; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; -import org.apache.drill.exec.work.fragment.FragmentManager; /** * Service that allows one Drillbit to communicate with another. Internally manages whether each particular bit is a @@ -34,7 +33,7 @@ public interface Controller extends Closeable { /** * Get a Bit to Bit communication tunnel. If the BitCom doesn't have a tunnel attached to the node already, it will * start creating one. This create the connection asynchronously. - * + * * @param node * @return */ @@ -42,5 +41,5 @@ public interface Controller extends Closeable { public DrillbitEndpoint start(DrillbitEndpoint partialEndpoint) throws InterruptedException, DrillbitStartupException; - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java index 1cacc4f63..f8f6fd795 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/ControllerImpl.java @@ -17,16 +17,12 @@ */ package org.apache.drill.exec.rpc.control; -import java.util.concurrent.ConcurrentMap; - import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.exception.DrillbitStartupException; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.server.BootStrapContext; import org.apache.drill.exec.work.batch.ControlMessageHandler; -import org.apache.drill.exec.work.fragment.FragmentManager; -import com.google.common.collect.Maps; import com.google.common.io.Closeables; /** diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java index ed0d37087..10fe34390 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/DefaultInstanceHandler.java @@ -30,7 +30,7 @@ import com.google.protobuf.MessageLite; public class DefaultInstanceHandler { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DefaultInstanceHandler.class); - + public static MessageLite getResponseDefaultInstance(int rpcType) throws RpcException { switch (rpcType) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java index cbfa1f943..60d2cdf9e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/control/WorkEventBus.java @@ -22,9 +22,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.LoadingCache; import org.apache.drill.exec.cache.DistributedMap; import org.apache.drill.exec.exception.FragmentSetupException; import org.apache.drill.exec.proto.BitControl.FragmentStatus; @@ -39,6 +36,8 @@ import org.apache.drill.exec.work.fragment.FragmentManager; import org.apache.drill.exec.work.fragment.NonRootFragmentManager; import org.apache.drill.exec.work.fragment.RootFragmentManager; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import com.google.common.collect.Maps; public class WorkEventBus { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/BitServerConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/BitServerConnection.java index 4583f8837..1d539a238 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/BitServerConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/BitServerConnection.java @@ -21,7 +21,6 @@ import io.netty.channel.Channel; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.rpc.RemoteConnection; -import org.apache.drill.exec.work.fragment.FragmentManager; public class BitServerConnection extends RemoteConnection{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BitServerConnection.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClient.java index ed512647c..67856f351 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClient.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClient.java @@ -45,14 +45,14 @@ public class DataClient extends BasicClient<RpcType, DataClientConnection, BitCl private final BufferAllocator allocator; private final DataConnectionManager.CloseHandlerCreator closeHandlerFactory; - + public DataClient(DrillbitEndpoint remoteEndpoint, BootStrapContext context, DataConnectionManager.CloseHandlerCreator closeHandlerFactory) { super(DataRpcConfig.MAPPING, context.getAllocator().getUnderlyingAllocator(), context.getBitClientLoopGroup(), RpcType.HANDSHAKE, BitServerHandshake.class, BitServerHandshake.PARSER); this.remoteEndpoint = remoteEndpoint; this.closeHandlerFactory = closeHandlerFactory; this.allocator = context.getAllocator(); } - + @Override public DataClientConnection initRemoteConnection(Channel channel) { this.connection = new DataClientConnection(channel, this); @@ -77,7 +77,7 @@ public class DataClient extends BasicClient<RpcType, DataClientConnection, BitCl BufferAllocator getAllocator(){ return allocator; } - + @Override protected void validateHandshake(BitServerHandshake handshake) throws RpcException { if(handshake.getRpcVersion() != DataRpcConfig.RPC_VERSION) throw new RpcException(String.format("Invalid rpc version. Expected %d, actual %d.", handshake.getRpcVersion(), DataRpcConfig.RPC_VERSION)); @@ -90,7 +90,7 @@ public class DataClient extends BasicClient<RpcType, DataClientConnection, BitCl public DataClientConnection getConnection(){ return this.connection; } - + @Override public ProtobufLengthDecoder getDecoder(BufferAllocator allocator) { return new DataProtobufLengthDecoder(allocator, OutOfMemoryHandler.DEFAULT_INSTANCE); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java index 9656a1409..ecd10eb7a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataClientConnection.java @@ -31,18 +31,18 @@ import com.google.common.io.Closeables; import com.google.protobuf.MessageLite; public class DataClientConnection extends RemoteConnection{ - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataClientConnection.class); - + static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataClientConnection.class); + private final DataClient client; private final UUID id; - + public DataClientConnection(Channel channel, DataClient client){ super(channel); this.client = client; // we use a local listener pool unless a global one is provided. this.id = UUID.randomUUID(); } - + @Override public BufferAllocator getAllocator() { return client.getAllocator(); @@ -50,10 +50,10 @@ public class DataClientConnection extends RemoteConnection{ public <SEND extends MessageLite, RECEIVE extends MessageLite> void send(RpcOutcomeListener<RECEIVE> outcomeListener, RpcType rpcType, SEND protobufBody, Class<RECEIVE> clazz, ByteBuf... dataBodies){ - client.send(outcomeListener, this, rpcType, protobufBody, clazz, dataBodies); - + client.send(outcomeListener, this, rpcType, protobufBody, clazz, dataBodies); + } - + @Override public int hashCode() { final int prime = 31; @@ -75,6 +75,6 @@ public class DataClientConnection extends RemoteConnection{ } public void shutdownIfClient(){ - Closeables.closeQuietly(client); + Closeables.closeQuietly(client); } }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionManager.java index bd0e9e044..b2ea85527 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataConnectionManager.java @@ -30,7 +30,7 @@ public class DataConnectionManager extends ReconnectingConnection<DataClientConn private final DrillbitEndpoint endpoint; private final BootStrapContext context; - + public DataConnectionManager(FragmentHandle handle, DrillbitEndpoint endpoint, BootStrapContext context) { super(hs(handle), endpoint.getAddress(), endpoint.getDataPort()); this.endpoint = endpoint; @@ -41,7 +41,7 @@ public class DataConnectionManager extends ReconnectingConnection<DataClientConn protected DataClient getNewClient() { return new DataClient(endpoint, context, new CloseHandlerCreator()); } - + private static BitClientHandshake hs(FragmentHandle handle){ return BitClientHandshake // .newBuilder() // diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataDefaultInstanceHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataDefaultInstanceHandler.java index 270dae63c..fab275ac6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataDefaultInstanceHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataDefaultInstanceHandler.java @@ -28,7 +28,7 @@ import com.google.protobuf.MessageLite; public class DataDefaultInstanceHandler { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataDefaultInstanceHandler.class); - + public static MessageLite getResponseDefaultInstanceClient(int rpcType) throws RpcException { switch (rpcType) { @@ -36,12 +36,12 @@ public class DataDefaultInstanceHandler { return Ack.getDefaultInstance(); case RpcType.HANDSHAKE_VALUE: return BitServerHandshake.getDefaultInstance(); - + default: throw new UnsupportedOperationException(); } } - + public static MessageLite getResponseDefaultInstanceServer(int rpcType) throws RpcException { switch (rpcType) { case RpcType.ACK_VALUE: @@ -50,7 +50,7 @@ public class DataDefaultInstanceHandler { return BitClientHandshake.getDefaultInstance(); case RpcType.REQ_RECORD_BATCH_VALUE: return FragmentRecordBatch.getDefaultInstance(); - + default: throw new UnsupportedOperationException(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataProtobufLengthDecoder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataProtobufLengthDecoder.java index b648c72de..193b0502f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataProtobufLengthDecoder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataProtobufLengthDecoder.java @@ -30,9 +30,10 @@ public class DataProtobufLengthDecoder extends ProtobufLengthDecoder{ public DataProtobufLengthDecoder(BufferAllocator allocator, OutOfMemoryHandler outOfMemoryHandler) { super(allocator, outOfMemoryHandler); - + } - + + @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { super.decode(ctx, in, out); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataRpcConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataRpcConfig.java index 45d95d9be..6d0901ff9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataRpcConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataRpcConfig.java @@ -22,7 +22,6 @@ import org.apache.drill.exec.proto.BitData.BitClientHandshake; import org.apache.drill.exec.proto.BitData.BitServerHandshake; import org.apache.drill.exec.proto.BitData.FragmentRecordBatch; import org.apache.drill.exec.proto.BitData.RpcType; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.GeneralRPCProtos.Ack; import org.apache.drill.exec.rpc.Acks; import org.apache.drill.exec.rpc.Response; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataServer.java index 8611b5aec..8e503ec6a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataServer.java @@ -17,8 +17,8 @@ */ package org.apache.drill.exec.rpc.data; -import io.netty.buffer.DrillBuf; import io.netty.buffer.ByteBuf; +import io.netty.buffer.DrillBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.util.concurrent.GenericFutureListener; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataTunnel.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataTunnel.java index 546f96744..5aa4aa67c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataTunnel.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/data/DataTunnel.java @@ -28,9 +28,9 @@ import org.apache.drill.exec.record.FragmentWritableBatch; import org.apache.drill.exec.rpc.DrillRpcFuture; import org.apache.drill.exec.rpc.FutureBitCommand; import org.apache.drill.exec.rpc.ListeningCommand; +import org.apache.drill.exec.rpc.RpcConnectionHandler.FailureType; import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; -import org.apache.drill.exec.rpc.RpcConnectionHandler.FailureType; public class DataTunnel { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java index 4bbb13e5e..b12a4cfdf 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/QueryResultHandler.java @@ -27,7 +27,6 @@ import org.apache.drill.exec.proto.UserBitShared; import org.apache.drill.exec.proto.UserBitShared.QueryId; import org.apache.drill.exec.proto.UserBitShared.QueryResult; import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState; -import org.apache.drill.exec.proto.beans.DrillPBError; import org.apache.drill.exec.rpc.BaseRpcOutcomeListener; import org.apache.drill.exec.rpc.RpcBus; import org.apache.drill.exec.rpc.RpcException; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java index d49a9fdb6..f352a1539 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java @@ -84,6 +84,7 @@ public class UserClient extends BasicClientWithConnection<RpcType, UserToBitHand throw new RpcException(String.format("Unable to deal with RpcType of %d", rpcType)); } + @Override protected Response handleReponse(ConnectionThrottle throttle, int rpcType, ByteBuf pBody, ByteBuf dBody) throws RpcException { switch (rpcType) { case RpcType.QUERY_RESULT_VALUE: diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserProtobufLengthDecoder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserProtobufLengthDecoder.java index 99e77774c..266f112f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserProtobufLengthDecoder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserProtobufLengthDecoder.java @@ -30,8 +30,9 @@ public class UserProtobufLengthDecoder extends ProtobufLengthDecoder{ public UserProtobufLengthDecoder(BufferAllocator allocator, OutOfMemoryHandler outOfMemoryHandler) { super(allocator, outOfMemoryHandler); - + } + @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { super.decode(ctx, in, out); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserResultsListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserResultsListener.java index 71f59948e..9f83a4f85 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserResultsListener.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserResultsListener.java @@ -21,9 +21,9 @@ import org.apache.drill.exec.proto.UserBitShared.QueryId; import org.apache.drill.exec.rpc.RpcException; public interface UserResultsListener { - + public abstract void queryIdArrived(QueryId queryId); - public abstract void submissionFailed(RpcException ex); + public abstract void submissionFailed(RpcException ex); public abstract void resultArrived(QueryResultBatch result, ConnectionThrottle throttle); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java index 9b5e83016..e386ad3a6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java @@ -33,7 +33,6 @@ import org.apache.drill.exec.proto.UserProtos.RequestResults; import org.apache.drill.exec.proto.UserProtos.RpcType; import org.apache.drill.exec.proto.UserProtos.RunQuery; import org.apache.drill.exec.proto.UserProtos.UserToBitHandshake; -import org.apache.drill.exec.rpc.Acks; import org.apache.drill.exec.rpc.BasicServer; import org.apache.drill.exec.rpc.OutOfMemoryHandler; import org.apache.drill.exec.rpc.ProtobufLengthDecoder; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java index e7be3807a..2710837d3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java @@ -17,15 +17,17 @@ */ package org.apache.drill.exec.rpc.user; -import com.google.common.collect.Maps; +import java.util.Map; + import net.hydromatic.optiq.SchemaPlus; + import org.apache.drill.exec.proto.UserBitShared.UserCredentials; import org.apache.drill.exec.proto.UserProtos.Property; import org.apache.drill.exec.proto.UserProtos.UserProperties; import org.apache.drill.exec.server.options.OptionManager; import org.apache.drill.exec.server.options.SessionOptionManager; -import java.util.Map; +import com.google.common.collect.Maps; public class UserSession { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserSession.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DataRecord.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DataRecord.java index 6855e72ea..45f068369 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DataRecord.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DataRecord.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.schema; +import java.util.List; +import java.util.Map; + import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import java.util.List; -import java.util.Map; - public class DataRecord { private final Map<Integer, Object> dataMap; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DiffSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DiffSchema.java index dbc4fd672..af41e9a27 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DiffSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/DiffSchema.java @@ -17,10 +17,10 @@ */ package org.apache.drill.exec.schema; -import com.google.common.collect.Lists; - import java.util.List; +import com.google.common.collect.Lists; + public class DiffSchema { List<Field> addedFields; List<Field> removedFields; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java index 14049efaa..35732acce 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Field.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.schema; -import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.types.TypeProtos.MajorType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ListSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ListSchema.java index b2f1c4575..a8b13a134 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ListSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ListSchema.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.schema; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import java.util.List; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java index c207d39d3..20e055dab 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/NamedField.java @@ -40,6 +40,7 @@ public class NamedField extends Field { this.keyType = keyType; } + @Override public String getFieldName() { return fieldName; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ObjectSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ObjectSchema.java index 13f0dc153..19103d363 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ObjectSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/ObjectSchema.java @@ -17,14 +17,14 @@ */ package org.apache.drill.exec.schema; +import java.util.List; +import java.util.Map; + import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import java.util.List; -import java.util.Map; - public class ObjectSchema implements RecordSchema { private final Map<String, Field> fields; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Record.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Record.java index 096ef4c66..6fc3e8ffc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Record.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/Record.java @@ -17,10 +17,6 @@ */ package org.apache.drill.exec.schema; -import org.apache.drill.common.expression.PathSegment; -import org.apache.drill.common.expression.SchemaPath; - -import java.io.IOException; public interface Record { public DiffSchema getSchemaChanges(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java index 1e54336a1..93228c0ec 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/schema/json/jackson/JacksonHelper.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.schema.json.jackson; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; +import java.io.IOException; + import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; -import java.io.IOException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; public class JacksonHelper { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/BootStrapContext.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/BootStrapContext.java index 41d13a042..3da2ea932 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/BootStrapContext.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/BootStrapContext.java @@ -18,8 +18,6 @@ package org.apache.drill.exec.server; import io.netty.channel.EventLoopGroup; -import io.netty.channel.epoll.EpollEventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; import java.io.Closeable; @@ -28,7 +26,6 @@ import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.TopLevelAllocator; import org.apache.drill.exec.metrics.DrillMetrics; -import org.apache.drill.exec.rpc.NamedThreadFactory; import org.apache.drill.exec.rpc.TransportCheck; import com.codahale.metrics.MetricRegistry; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java index 57e07a04e..a9e11a411 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java @@ -19,8 +19,6 @@ package org.apache.drill.exec.server; import java.io.Closeable; -import javax.servlet.Servlet; - import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.cache.DistributedCache; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/StartupOptions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/StartupOptions.java index df0ee05e3..57b1e7861 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/StartupOptions.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/StartupOptions.java @@ -30,10 +30,10 @@ public class StartupOptions { @Parameter(names={"-h", "--help"}, description="Provide description of usage.", help=true) private boolean help = false; - + @Parameter(names= {"-d", "--debug"}, description="Whether you want to run the program in debug mode.", required=false) private boolean debug = false; - + @Parameter(names= {"-c", "--config"}, description="Configuration file you want to load. Defaults to loading 'drill-override.conf' from the classpath.", required=false) private String configLocation = null; @@ -62,5 +62,5 @@ public class StartupOptions { } return args; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/FragmentOptionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/FragmentOptionManager.java index aaf57197d..46d316b42 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/FragmentOptionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/FragmentOptionManager.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.server.options; +import java.util.Iterator; +import java.util.Map; + +import org.eigenbase.sql.SqlLiteral; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; -import org.eigenbase.sql.SqlLiteral; - -import java.util.Iterator; -import java.util.Map; public class FragmentOptionManager implements OptionManager { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FragmentOptionManager.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/QueryOptionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/QueryOptionManager.java index 8b5306fc3..7eda97e42 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/QueryOptionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/QueryOptionManager.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.server.options; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; -import org.eigenbase.sql.SqlLiteral; - import java.util.Iterator; import java.util.Map; +import org.eigenbase.sql.SqlLiteral; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; + public class QueryOptionManager implements OptionManager { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SessionOptionManager.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SessionOptionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SessionOptionManager.java index 53c26c1e1..4268d027d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SessionOptionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SessionOptionManager.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.server.options; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.Map; + import org.apache.drill.exec.server.options.OptionValue.OptionType; import org.eigenbase.sql.SqlLiteral; -import java.util.Iterator; -import java.util.Map; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; public class SessionOptionManager implements OptionManager{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SessionOptionManager.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java index d4ff6272c..40e2aafae 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java @@ -17,7 +17,11 @@ */ package org.apache.drill.exec.server.options; -import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ConcurrentMap; + import org.apache.commons.collections.IteratorUtils; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecConstants; @@ -30,10 +34,7 @@ import org.apache.drill.exec.store.sys.PStoreConfig; import org.apache.drill.exec.store.sys.PStoreProvider; import org.eigenbase.sql.SqlLiteral; -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; +import com.google.common.collect.Maps; public class SystemOptionManager implements OptionManager{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/TypeValidators.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/TypeValidators.java index 2f4337436..03982151e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/TypeValidators.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/options/TypeValidators.java @@ -17,14 +17,14 @@ */ package org.apache.drill.exec.server.options; +import java.math.BigDecimal; + import org.apache.drill.common.exceptions.ExpressionParsingException; import org.apache.drill.exec.server.options.OptionValue.Kind; import org.apache.drill.exec.server.options.OptionValue.OptionType; import org.eigenbase.sql.SqlLiteral; import org.eigenbase.util.NlsString; -import java.math.BigDecimal; - public class TypeValidators { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeValidators.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java index db07ab4a0..3e972b45a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/DrillRoot.java @@ -17,12 +17,7 @@ */ package org.apache.drill.exec.server.rest; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.google.common.collect.Lists; -import org.apache.drill.common.config.DrillConfig; -import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.work.WorkManager; -import org.glassfish.jersey.server.mvc.Viewable; +import java.util.List; import javax.inject.Inject; import javax.ws.rs.GET; @@ -30,7 +25,14 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; + +import org.apache.drill.common.config.DrillConfig; +import org.apache.drill.exec.proto.CoordinationProtos; +import org.apache.drill.exec.work.WorkManager; +import org.glassfish.jersey.server.mvc.Viewable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.google.common.collect.Lists; @Path("/") public class DrillRoot { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/MetricsResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/MetricsResources.java index 802b61f84..28a292ba2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/MetricsResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/MetricsResources.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.server.rest; -import org.glassfish.jersey.server.mvc.Viewable; - import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import org.glassfish.jersey.server.mvc.Viewable; + @Path("/metrics") public class MetricsResources { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MetricsResources.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/PluginConfigWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/PluginConfigWrapper.java index 003f8ae78..ba5478137 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/PluginConfigWrapper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/PluginConfigWrapper.java @@ -18,13 +18,14 @@ package org.apache.drill.exec.server.rest; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import javax.xml.bind.annotation.XmlRootElement; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.logical.StoragePluginConfig; import org.apache.drill.exec.store.StoragePluginRegistry; -import javax.xml.bind.annotation.XmlRootElement; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; @XmlRootElement public class PluginConfigWrapper { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ProfileWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ProfileWrapper.java index 63ecb986d..d158cccd2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ProfileWrapper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ProfileWrapper.java @@ -17,7 +17,16 @@ */ package org.apache.drill.exec.server.rest; -import com.google.common.base.Preconditions; +import java.text.DateFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; @@ -28,22 +37,13 @@ import org.apache.drill.exec.proto.UserBitShared.QueryProfile; import org.apache.drill.exec.proto.UserBitShared.StreamProfile; import org.apache.drill.exec.proto.helper.QueryIdHelper; +import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import java.text.DateFormat; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Locale; -import java.util.Map; - public class ProfileWrapper { public QueryProfile profile; @@ -528,6 +528,7 @@ public class ProfileWrapper { appendCell(Long.toString(l), link); } + @Override public String toString() { String rv; rv = sb.append("\n</table>").toString(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java index 8ad32b141..bea693c33 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java @@ -29,7 +29,6 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import javax.xml.bind.annotation.XmlRootElement; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.coord.ClusterCoordinator; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java index 8f299bbff..7bf390979 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java @@ -18,8 +18,16 @@ package org.apache.drill.exec.server.rest; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.xml.bind.annotation.XmlRootElement; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.client.DrillClient; import org.apache.drill.exec.coord.ClusterCoordinator; @@ -34,14 +42,8 @@ import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.rpc.user.UserResultsListener; import org.apache.drill.exec.vector.ValueVector; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; @XmlRootElement public class QueryWrapper { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java index 79150d988..c99c49b46 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java @@ -17,13 +17,8 @@ */ package org.apache.drill.exec.server.rest; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import org.apache.drill.exec.server.options.OptionManager; -import org.apache.drill.exec.server.options.OptionValue; -import org.apache.drill.exec.server.options.OptionValue.Kind; -import org.apache.drill.exec.work.WorkManager; -import org.glassfish.jersey.server.mvc.Viewable; +import java.util.LinkedList; +import java.util.List; import javax.inject.Inject; import javax.ws.rs.Consumes; @@ -31,12 +26,17 @@ import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlRootElement; -import java.util.LinkedList; -import java.util.List; + +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.server.options.OptionValue.Kind; +import org.apache.drill.exec.work.WorkManager; +import org.glassfish.jersey.server.mvc.Viewable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; @Path("/") public class StatusResources { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java index e841430cb..49f387cb3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java @@ -17,16 +17,12 @@ */ package org.apache.drill.exec.server.rest; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.Lists; -import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.common.logical.StoragePluginConfig; -import org.apache.drill.exec.store.StoragePlugin; -import org.apache.drill.exec.store.StoragePluginRegistry; -import org.apache.drill.exec.store.sys.PStoreProvider; -import org.glassfish.jersey.server.mvc.Viewable; +import java.io.IOException; +import java.io.StringReader; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; import javax.inject.Inject; import javax.ws.rs.Consumes; @@ -39,12 +35,17 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.xml.bind.annotation.XmlRootElement; -import java.io.IOException; -import java.io.StringReader; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map; + +import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.common.logical.StoragePluginConfig; +import org.apache.drill.exec.store.StoragePlugin; +import org.apache.drill.exec.store.StoragePluginRegistry; +import org.glassfish.jersey.server.mvc.Viewable; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.Lists; @Path("/") public class StorageResources { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ThreadsResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ThreadsResources.java index 0fc80557c..def5acb66 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ThreadsResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/ThreadsResources.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.server.rest; -import org.glassfish.jersey.server.mvc.Viewable; - import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import org.glassfish.jersey.server.mvc.Viewable; + @Path("/threads") public class ThreadsResources { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MetricsResources.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/WebResourceServer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/WebResourceServer.java index 33b9be962..249cb8c07 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/WebResourceServer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/WebResourceServer.java @@ -49,7 +49,7 @@ public class WebResourceServer { String s = "rest/www/" + path; ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream is = new BufferedInputStream(cl.getResource(s).openStream()); - + String mime = "text/plain"; if (s.endsWith(".js")) { mime = "text/javascript"; @@ -58,14 +58,14 @@ public class WebResourceServer { } else { mime = URLConnection.guessContentTypeFromStream(is); } - + byte[] d = IOUtils.toByteArray(is); - return Response.ok(d).type(mime).build(); + return Response.ok(d).type(mime).build(); } catch (Exception e) { e.printStackTrace(); e.printStackTrace(System.out); } - + return Response.noContent().status(Status.NOT_FOUND).build(); } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java index ce109d997..ff6e13cd0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/service/ServiceEngine.java @@ -17,8 +17,6 @@ */ package org.apache.drill.exec.service; -import io.netty.channel.nio.NioEventLoopGroup; - import java.io.Closeable; import java.io.IOException; import java.net.InetAddress; @@ -28,7 +26,6 @@ import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.exception.DrillbitStartupException; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; -import org.apache.drill.exec.rpc.NamedThreadFactory; import org.apache.drill.exec.rpc.TransportCheck; import org.apache.drill.exec.rpc.control.Controller; import org.apache.drill.exec.rpc.control.ControllerImpl; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractRecordReader.java index 209ec8fd7..554b3e77c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractRecordReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractRecordReader.java @@ -20,14 +20,15 @@ package org.apache.drill.exec.store; import java.util.Collection; import java.util.Map; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.record.MaterializedField.Key; import org.apache.drill.exec.vector.ValueVector; +import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + public abstract class AbstractRecordReader implements RecordReader { private static final String COL_NULL_ERROR = "Columns cannot be null. Use star column to select all fields."; private static final String COL_EMPTY_ERROR = "Readers needs at least a column to read."; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractSchema.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractSchema.java index f34b1e3a1..90e3ef489 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractSchema.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractSchema.java @@ -22,18 +22,17 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import net.hydromatic.linq4j.expressions.DefaultExpression; import net.hydromatic.linq4j.expressions.Expression; import net.hydromatic.optiq.Function; import net.hydromatic.optiq.Schema; import net.hydromatic.optiq.SchemaPlus; - import net.hydromatic.optiq.Table; + import org.apache.drill.exec.planner.logical.CreateTableEntry; -import org.apache.drill.exec.planner.logical.DrillTable; + +import com.google.common.base.Joiner; +import com.google.common.collect.Lists; public abstract class AbstractSchema implements Schema{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractSchema.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java index 9cdfe245c..b032fce87 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractStoragePlugin.java @@ -32,7 +32,7 @@ public abstract class AbstractStoragePlugin implements StoragePlugin{ protected AbstractStoragePlugin(){ } - + @Override public boolean supportsRead() { return false; @@ -52,7 +52,7 @@ public abstract class AbstractStoragePlugin implements StoragePlugin{ public AbstractGroupScan getPhysicalScan(JSONOptions selection) throws IOException { return getPhysicalScan(selection, AbstractGroupScan.ALL_COLUMNS); } - + @Override public AbstractGroupScan getPhysicalScan(JSONOptions selection, List<SchemaPath> columns) throws IOException { throw new UnsupportedOperationException(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ClassPathFileSystem.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ClassPathFileSystem.java index f7d3c6776..5e00f087b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ClassPathFileSystem.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ClassPathFileSystem.java @@ -37,9 +37,9 @@ public class ClassPathFileSystem extends FileSystem{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ClassPathFileSystem.class); static final String ERROR_MSG = "ClassPathFileSystem is read only."; - + private Path working; - + @Override public FSDataOutputStream append(Path arg0, int arg1, Progressable arg2) throws IOException { throw new IOException(ERROR_MSG); @@ -68,18 +68,18 @@ public class ClassPathFileSystem extends FileSystem{ } return file; } - + @Override public FileStatus getFileStatus(Path arg0) throws IOException { String file = getFileName(arg0); - - try{ + + try{ URL url = Resources.getResource(file); if(url == null){ throw new IOException(String.format("Unable to find path %s.", arg0.toString())); } - - + + return new FileStatus(Resources.asByteSource(url).size(), false, 1, 8096, System.currentTimeMillis(), arg0); }catch(RuntimeException e){ throw new IOException(String.format("Failure trying to load file %s", arg0), e); @@ -130,7 +130,7 @@ public class ClassPathFileSystem extends FileSystem{ public void setWorkingDirectory(Path arg0) { this.working = arg0; } - + public static void main(String[] args) throws Exception{ URI uri = new URI("classpath:///"); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordReader.java index 42cdcc385..09495f5ef 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordReader.java @@ -17,16 +17,15 @@ */ package org.apache.drill.exec.store; +import java.util.Map; + import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.memory.OutOfMemoryException; +import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.impl.OutputMutator; -import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.MaterializedField.Key; import org.apache.drill.exec.vector.ValueVector; -import java.util.Map; - public interface RecordReader { public static final long ALLOCATOR_INITIAL_RESERVATION = 1*1024*1024; @@ -34,7 +33,7 @@ public interface RecordReader { /** * Configure the RecordReader with the provided schema and the record batch that should be written to. - * + * * @param output * The place where output for a particular scan should be written. The record reader is responsible for * mutating the set of schema values for that particular record. @@ -53,8 +52,8 @@ public interface RecordReader { /** - * Increment record reader forward, writing into the provided output batch. - * + * Increment record reader forward, writing into the provided output batch. + * * @return The number of additional records added to the output. */ public abstract int next(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordRecorder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordRecorder.java index 17dbdb110..ffaff8f85 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordRecorder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/RecordRecorder.java @@ -23,14 +23,14 @@ import org.apache.drill.exec.record.RecordBatch; public interface RecordRecorder { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RecordRecorder.class); - + public void setup() throws IOException; - + /** - * + * * @param batch * @return */ public boolean record(RecordBatch batch); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ResourceInputStream.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ResourceInputStream.java index fb58c3d0b..5d7ea2cc5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ResourceInputStream.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ResourceInputStream.java @@ -32,8 +32,8 @@ public class ResourceInputStream extends ByteArrayInputStream implements Seekabl super(bytes); } - - + + @Override public void readFully(long position, byte[] buffer) throws IOException { @@ -65,7 +65,7 @@ public class ResourceInputStream extends ByteArrayInputStream implements Seekabl System.arraycopy(buf, start, b, off, len); return len; } - + @Override public void readFully(long position, byte[] buffer, int offset, int length) throws IOException { int l = read(position, buffer, offset, length); @@ -77,7 +77,7 @@ public class ResourceInputStream extends ByteArrayInputStream implements Seekabl return pos; } - + @Override public int read(byte[] b) throws IOException { int l = read(pos, b, 0, b.length); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaFactory.java index 5acbe7833..feadabdd6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaFactory.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaFactory.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.store; import net.hydromatic.optiq.SchemaPlus; -import org.apache.drill.exec.rpc.user.DrillUser; import org.apache.drill.exec.rpc.user.UserSession; public interface SchemaFactory { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java index 653d69db0..ef5978c8b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePlugin.java @@ -35,7 +35,7 @@ public interface StoragePlugin extends SchemaFactory { /** * Get the physical scan operator for the particular GroupScan (read) node. - * + * * @param selection * The configured storage engine specific selection. * @return @@ -46,7 +46,7 @@ public interface StoragePlugin extends SchemaFactory { /** * Get the physical scan operator for the particular GroupScan (read) node. - * + * * @param selection * The configured storage engine specific selection. * @param columns diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/SubSchemaWrapper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/SubSchemaWrapper.java index 2d8dee8e9..2c0d8b8d2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/SubSchemaWrapper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/SubSchemaWrapper.java @@ -17,14 +17,16 @@ */ package org.apache.drill.exec.store; -import com.google.common.collect.ImmutableList; +import java.util.Collection; +import java.util.Set; + import net.hydromatic.optiq.Function; import net.hydromatic.optiq.Schema; import net.hydromatic.optiq.Table; + import org.apache.drill.exec.planner.logical.CreateTableEntry; -import java.util.Collection; -import java.util.Set; +import com.google.common.collect.ImmutableList; public class SubSchemaWrapper extends AbstractSchema { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/VectorHolder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/VectorHolder.java index ef26d1189..8387d49a6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/VectorHolder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/VectorHolder.java @@ -31,7 +31,7 @@ public class VectorHolder { private int currentLength; private boolean repeated; - + public VectorHolder(int length, ValueVector vector) { this.length = length; this.vector = vector; @@ -39,7 +39,7 @@ public class VectorHolder { repeated = true; } } - + public VectorHolder(ValueVector vector) { this.length = vector.getValueCapacity(); this.vector = vector; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/BasicFormatMatcher.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/BasicFormatMatcher.java index 4ac79fd5e..dda2dfc36 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/BasicFormatMatcher.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/BasicFormatMatcher.java @@ -20,21 +20,19 @@ package org.apache.drill.exec.store.dfs; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.io.compress.CompressionCodec; +import org.apache.hadoop.io.compress.CompressionCodecFactory; -import com.google.common.collect.Lists; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import com.google.common.collect.Range; -import org.apache.hadoop.io.compress.CompressionCodec; -import org.apache.hadoop.io.compress.CompressionCodecFactory; public class BasicFormatMatcher extends FormatMatcher{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BasicFormatMatcher.class); @@ -45,7 +43,7 @@ public class BasicFormatMatcher extends FormatMatcher{ protected final FormatPlugin plugin; protected final boolean compressible; protected final CompressionCodecFactory codecFactory; - + public BasicFormatMatcher(FormatPlugin plugin, DrillFileSystem fs, List<Pattern> patterns, List<MagicString> magicStrings) { super(); this.patterns = ImmutableList.copyOf(patterns); @@ -55,7 +53,7 @@ public class BasicFormatMatcher extends FormatMatcher{ this.compressible = false; this.codecFactory = null; } - + public BasicFormatMatcher(FormatPlugin plugin, DrillFileSystem fs, List<String> extensions, boolean compressible){ List<Pattern> patterns = Lists.newArrayList(); for (String extension : extensions) { @@ -68,7 +66,7 @@ public class BasicFormatMatcher extends FormatMatcher{ this.compressible = compressible; this.codecFactory = new CompressionCodecFactory(fs.getUnderlying().getConf()); } - + @Override public boolean supportDirectoryReads() { return false; @@ -105,12 +103,12 @@ public class BasicFormatMatcher extends FormatMatcher{ return true; } } - + if(matcher.matches(status)) return true; return false; } - - + + @Override @JsonIgnore public FormatPlugin getFormatPlugin() { @@ -119,20 +117,20 @@ public class BasicFormatMatcher extends FormatMatcher{ private class MagicStringMatcher{ - + private List<RangeMagics> ranges; - + public MagicStringMatcher(List<MagicString> magicStrings){ ranges = Lists.newArrayList(); for(MagicString ms : magicStrings){ ranges.add(new RangeMagics(ms)); } } - + public boolean matches(FileStatus status) throws IOException{ if(ranges.isEmpty()) return false; final Range<Long> fileRange = Range.closedOpen( 0L, status.getLen()); - + try(FSDataInputStream is = fs.open(status.getPath()).getInputStream()){ for(RangeMagics rMagic : ranges){ Range<Long> r = rMagic.range; @@ -141,18 +139,18 @@ public class BasicFormatMatcher extends FormatMatcher{ byte[] bytes = new byte[len]; is.readFully(r.lowerEndpoint(), bytes); for(byte[] magic : rMagic.magics){ - if(Arrays.equals(magic, bytes)) return true; + if(Arrays.equals(magic, bytes)) return true; } - + } } return false; } - + private class RangeMagics{ Range<Long> range; byte[][] magics; - + public RangeMagics(MagicString ms){ this.range = Range.closedOpen( ms.getOffset(), (long) ms.getBytes().length); this.magics = new byte[][]{ms.getBytes()}; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java index 4fbe87cd6..76f6be4d9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSelection.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import com.google.common.base.Preconditions; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; @@ -29,6 +28,7 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.Preconditions; import com.google.common.collect.Lists; /** @@ -52,7 +52,7 @@ public class FileSelection { this.files = files; this.selectionRoot = selectionRoot; } - + public FileSelection(List<String> files, boolean dummy){ this.files = files; } @@ -108,7 +108,7 @@ public class FileSelection { } return files; } - + private void init(DrillFileSystem fs) throws IOException { if (files != null && statuses == null) { statuses = Lists.newArrayList(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemSchemaFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemSchemaFactory.java index 3b74b7282..4a3eba906 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemSchemaFactory.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FileSystemSchemaFactory.java @@ -22,25 +22,20 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.google.common.collect.ImmutableList; - import net.hydromatic.optiq.Function; import net.hydromatic.optiq.Schema; import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.Table; import org.apache.drill.exec.planner.logical.CreateTableEntry; -import org.apache.drill.exec.planner.logical.DrillTable; -import org.apache.drill.exec.rpc.user.DrillUser; import org.apache.drill.exec.rpc.user.UserSession; import org.apache.drill.exec.store.AbstractSchema; import org.apache.drill.exec.store.SchemaFactory; import org.apache.drill.exec.store.dfs.WorkspaceSchemaFactory.WorkspaceSchema; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; -import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; - /** * This is the top level schema that responds to root level path requests. Also supports diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java index b40502f65..0d0d46a54 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatCreator.java @@ -35,24 +35,24 @@ import com.google.common.collect.Maps; public class FormatCreator { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FormatCreator.class); - - + + static final ConstructorChecker FORMAT_BASED = new ConstructorChecker(String.class, DrillbitContext.class, DrillFileSystem.class, StoragePluginConfig.class, FormatPluginConfig.class); static final ConstructorChecker DEFAULT_BASED = new ConstructorChecker(String.class, DrillbitContext.class, DrillFileSystem.class, StoragePluginConfig.class); - + static Map<String, FormatPlugin> getFormatPlugins(DrillbitContext context, DrillFileSystem fileSystem, FileSystemConfig storageConfig){ - final DrillConfig config = context.getConfig(); + final DrillConfig config = context.getConfig(); Map<String, FormatPlugin> plugins = Maps.newHashMap(); Collection<Class<? extends FormatPlugin>> pluginClasses = PathScanner.scanForImplementations(FormatPlugin.class, config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES)); - + if(storageConfig.formats == null || storageConfig.formats.isEmpty()){ - + for(Class<? extends FormatPlugin> pluginClass: pluginClasses){ for(Constructor<?> c : pluginClass.getConstructors()){ try{ - + if(!DEFAULT_BASED.check(c)) continue; FormatPlugin plugin = (FormatPlugin) c.newInstance(null, context, fileSystem, storageConfig); plugins.put(plugin.getName(), plugin); @@ -61,9 +61,9 @@ public class FormatCreator { } } } - + }else{ - + Map<Class<?>, Constructor<?>> constructors = Maps.newHashMap(); for(Class<? extends FormatPlugin> pluginClass: pluginClasses){ for(Constructor<?> c : pluginClass.getConstructors()){ @@ -76,7 +76,7 @@ public class FormatCreator { } } } - + for(Map.Entry<String, FormatPluginConfig> e : storageConfig.formats.entrySet()){ Constructor<?> c = constructors.get(e.getValue().getClass()); if(c == null){ @@ -89,13 +89,13 @@ public class FormatCreator { logger.warn("Failure initializing storage config named '{}' of type '{}'.", e.getKey(), e.getValue().getClass().getName(), e1); } } - - + + } - + return plugins; } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java index 20ea0a412..27f83f016 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatPlugin.java @@ -39,7 +39,7 @@ public interface FormatPlugin { public boolean supportsRead(); public boolean supportsWrite(); - + public FormatMatcher getMatcher(); public AbstractWriter getWriter(PhysicalOperator child, String location) throws IOException; @@ -47,13 +47,13 @@ public interface FormatPlugin { public AbstractGroupScan getGroupScan(FileSelection selection) throws IOException; public Set<StoragePluginOptimizerRule> getOptimizerRules(); - + public AbstractGroupScan getGroupScan(FileSelection selection, List<SchemaPath> columns) throws IOException; - + public FormatPluginConfig getConfig(); public StoragePluginConfig getStorageConfig(); public DrillFileSystem getFileSystem(); public DrillbitContext getContext(); public String getName(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatSelection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatSelection.java index 5cf6ce390..1ea7da7da 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatSelection.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/FormatSelection.java @@ -28,18 +28,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class FormatSelection { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FormatSelection.class); - + private FormatPluginConfig format; private FileSelection selection; public FormatSelection(){} - + @JsonCreator public FormatSelection(@JsonProperty("format") FormatPluginConfig format, @JsonProperty("files") List<String> files){ this.format = format; this.selection = new FileSelection(files, true); } - + public FormatSelection(FormatPluginConfig format, FileSelection selection) { super(); this.format = format; @@ -50,15 +50,15 @@ public class FormatSelection { public FormatPluginConfig getFormat(){ return format; } - + @JsonProperty("files") public List<String> getAsFiles(){ return selection.getAsFiles(); } - + @JsonIgnore public FileSelection getSelection(){ return selection; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/MagicString.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/MagicString.java index f514388be..0d4a0f594 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/MagicString.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/MagicString.java @@ -19,10 +19,10 @@ package org.apache.drill.exec.store.dfs; public class MagicString { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MagicString.class); - + private long offset; private byte[] bytes; - + public MagicString(long offset, byte[] bytes) { super(); this.offset = offset; @@ -36,7 +36,7 @@ public class MagicString { public byte[] getBytes() { return bytes; } - - - + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/NamedFormatPluginConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/NamedFormatPluginConfig.java index 173dfeb64..6a54bb346 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/NamedFormatPluginConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/NamedFormatPluginConfig.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.store.dfs; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.drill.common.logical.FormatPluginConfig; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/ReadEntryWithPath.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/ReadEntryWithPath.java index e421eec12..ba8f99c3f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/ReadEntryWithPath.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/ReadEntryWithPath.java @@ -22,14 +22,14 @@ public class ReadEntryWithPath { protected String path; - + public ReadEntryWithPath(String path) { super(); this.path = path; } public ReadEntryWithPath(){} - + public String getPath(){ return path; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java index 4b4266057..4349fe069 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java @@ -18,11 +18,8 @@ package org.apache.drill.exec.store.dfs; import java.io.IOException; -import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import net.hydromatic.optiq.Table; @@ -30,7 +27,6 @@ import net.hydromatic.optiq.Table; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ExecConstants; -import org.apache.drill.exec.cache.DistributedCache.CacheConfig; import org.apache.drill.exec.dotdrill.DotDrillFile; import org.apache.drill.exec.dotdrill.DotDrillType; import org.apache.drill.exec.dotdrill.DotDrillUtil; @@ -41,18 +37,15 @@ import org.apache.drill.exec.planner.logical.DrillViewTable; import org.apache.drill.exec.planner.logical.DynamicDrillTable; import org.apache.drill.exec.planner.logical.FileSystemCreateTableEntry; import org.apache.drill.exec.planner.sql.ExpandingConcurrentMap; -import org.apache.drill.exec.planner.sql.ExpandingConcurrentMap.MapValueFactory; import org.apache.drill.exec.rpc.user.UserSession; import org.apache.drill.exec.store.AbstractSchema; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; -import org.apache.drill.exec.store.dfs.shim.DrillInputStream; import org.apache.drill.exec.store.dfs.shim.DrillOutputStream; import org.apache.drill.exec.store.sys.PStore; import org.apache.drill.exec.store.sys.PStoreConfig; import org.apache.drill.exec.store.sys.PStoreProvider; import org.apache.hadoop.fs.Path; -import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Joiner; import com.google.common.collect.Lists; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java index 366904478..0c13990c5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.store.dfs.easy; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.regex.Matcher; @@ -36,7 +35,6 @@ import org.apache.drill.exec.physical.base.AbstractWriter; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.impl.ScanBatch; import org.apache.drill.exec.physical.impl.WriterRecordBatch; -import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.store.AbstractRecordReader; @@ -51,8 +49,8 @@ import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.compress.CompressionCodecFactory; -import com.google.common.collect.Lists; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements FormatPlugin { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(EasyFormatPlugin.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java index 2bdf1a660..1341fa40f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyGroupScan.java @@ -219,6 +219,7 @@ public class EasyGroupScan extends AbstractGroupScan{ return newScan; } + @Override @JsonIgnore public boolean canPushdownProjects(List<SchemaPath> columns) { return formatPlugin.supportsPushDown(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasySubScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasySubScan.java index 5f9226e36..e78ba0b5e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasySubScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasySubScan.java @@ -21,12 +21,10 @@ import java.io.IOException; import java.util.List; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.FormatPluginConfig; import org.apache.drill.common.logical.StoragePluginConfig; import org.apache.drill.exec.physical.base.AbstractSubScan; -import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; import org.apache.drill.exec.store.StoragePluginRegistry; import org.apache.drill.exec.store.dfs.NamedFormatPluginConfig; import org.apache.drill.exec.store.schedule.CompleteFileWork.FileWorkImpl; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/FileWork.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/FileWork.java index 170d339c3..80bcef20a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/FileWork.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/FileWork.java @@ -20,8 +20,8 @@ package org.apache.drill.exec.store.dfs.easy; public interface FileWork { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FileWork.class); - - public String getPath(); + + public String getPath(); public long getStart(); - public long getLength(); + public long getLength(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillFileSystem.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillFileSystem.java index 8af6aaf5a..a78871e4d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillFileSystem.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillFileSystem.java @@ -33,11 +33,11 @@ public abstract class DrillFileSystem implements AutoCloseable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillFileSystem.class); public abstract FileSystem getUnderlying(); - + public abstract BlockLocation[] getBlockLocations(FileStatus status, long start, long length) throws IOException; public abstract List<FileStatus> list(boolean recursive, Path... paths) throws IOException; public abstract FileStatus getFileStatus(Path p) throws IOException; public abstract DrillOutputStream create(Path p) throws IOException; public abstract DrillInputStream open(Path p) throws IOException; - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillInputStream.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillInputStream.java index 82764a371..8c3b5ae52 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillInputStream.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillInputStream.java @@ -25,8 +25,8 @@ public abstract class DrillInputStream implements AutoCloseable{ // public abstract AccountingByteBuf readNow(long start, long length) throws IOException; // public abstract void readNow(AccountingByteBuf b, long start, long length) throws IOException; // public abstract AccountingByteBuf readNow() throws IOException; - + public abstract FSDataInputStream getInputStream(); // public abstract CheckedFuture<Long, IOException> readFuture(AccountingByteBuf b, long start, long length) throws IOException; - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillOutputStream.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillOutputStream.java index c2446e996..8e562320f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillOutputStream.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/DrillOutputStream.java @@ -25,5 +25,5 @@ public abstract class DrillOutputStream implements AutoCloseable{ public abstract OutputStream getOuputStream(); // public abstract CheckedFuture<Long, IOException> writeFuture(AccountingByteBuf b); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/FileSystemCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/FileSystemCreator.java index eaab5ef93..a5ad257ed 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/FileSystemCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/FileSystemCreator.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.store.dfs.shim; import java.io.IOException; -import java.net.URI; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.store.dfs.shim.fallback.FallbackFileSystem; @@ -27,10 +26,10 @@ import org.apache.hadoop.fs.FileSystem; public class FileSystemCreator { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FileSystemCreator.class); - + public static DrillFileSystem getFileSystem(DrillConfig config, Configuration fsConf) throws IOException{ FileSystem fs = FileSystem.get(fsConf); return new FallbackFileSystem(config, fs); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/fallback/FallbackFileSystem.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/fallback/FallbackFileSystem.java index 0c18e71b9..3d1b9f2cb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/fallback/FallbackFileSystem.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/shim/fallback/FallbackFileSystem.java @@ -62,7 +62,7 @@ public class FallbackFileSystem extends DrillFileSystem { } } - + private void addRecursiveStatus(FileStatus parent, List<FileStatus> listToFill) throws IOException { if (parent.isDir()) { Path pattern = new Path(parent.getPath(), "*"); @@ -107,7 +107,7 @@ public class FallbackFileSystem extends DrillFileSystem { private class Out extends DrillOutputStream { private final FSDataOutputStream out; - + public Out(FSDataOutputStream out) { super(); this.out = out; @@ -128,7 +128,7 @@ public class FallbackFileSystem extends DrillFileSystem { private class In extends DrillInputStream { private final FSDataInputStream in; - + public In(FSDataInputStream in) { super(); this.in = in; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/direct/DirectGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/direct/DirectGroupScan.java index 122e60ddf..cc8386da7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/direct/DirectGroupScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/direct/DirectGroupScan.java @@ -28,7 +28,6 @@ import org.apache.drill.exec.physical.base.AbstractGroupScan; import org.apache.drill.exec.physical.base.GroupScan; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.ScanStats; -import org.apache.drill.exec.physical.base.ScanStats.GroupScanProperty; import org.apache.drill.exec.physical.base.SubScan; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.store.RecordReader; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONFormatPlugin.java index 4adac20f4..8cd7cf279 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONFormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONFormatPlugin.java @@ -21,12 +21,7 @@ import java.io.IOException; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.google.common.collect.Lists; - -import com.google.common.collect.Maps; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.common.expression.FieldReference; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.FormatPluginConfig; import org.apache.drill.common.logical.StoragePluginConfig; @@ -42,10 +37,11 @@ import org.apache.drill.exec.store.dfs.easy.EasyWriter; import org.apache.drill.exec.store.dfs.easy.FileWork; import org.apache.drill.exec.store.dfs.shim.DrillFileSystem; import org.apache.drill.exec.store.easy.json.JSONFormatPlugin.JSONFormatConfig; +import org.apache.hadoop.fs.FileSystem; import com.fasterxml.jackson.annotation.JsonTypeName; -import org.apache.drill.exec.store.text.DrillTextRecordWriter; -import org.apache.hadoop.fs.FileSystem; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; public class JSONFormatPlugin extends EasyFormatPlugin<JSONFormatConfig> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader2.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader2.java index 2bd9df576..c2218b5d7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader2.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JSONRecordReader2.java @@ -21,30 +21,25 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; -import com.fasterxml.jackson.core.JsonParseException; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.expression.SchemaPath; -import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.store.RecordReader; import org.apache.drill.exec.vector.BaseValueVector; -import org.apache.drill.exec.vector.complex.fn.JsonReader; import org.apache.drill.exec.vector.complex.fn.JsonReaderWithState; import org.apache.drill.exec.vector.complex.fn.JsonRecordSplitter; import org.apache.drill.exec.vector.complex.fn.UTF8JsonRecordSplitter; import org.apache.drill.exec.vector.complex.impl.VectorContainerWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter; -import org.apache.drill.exec.vector.complex.writer.FieldWriter; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import com.google.common.collect.Lists; +import com.fasterxml.jackson.core.JsonParseException; public class JSONRecordReader2 extends AbstractRecordReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JSONRecordReader2.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JsonRecordWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JsonRecordWriter.java index da9f48b77..76c4ace72 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JsonRecordWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/JsonRecordWriter.java @@ -17,8 +17,10 @@ */ package org.apache.drill.exec.store.easy.json; -import com.fasterxml.jackson.core.JsonFactory; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import java.util.Map; + import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.store.EventBasedRecordWriter; import org.apache.drill.exec.store.EventBasedRecordWriter.FieldConverter; @@ -30,9 +32,8 @@ import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import java.io.IOException; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.core.JsonFactory; +import com.google.common.collect.Lists; public class JsonRecordWriter extends JSONOutputRecordWriter implements RecordWriter { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/TextFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/TextFormatPlugin.java index 6e1aa0ad0..ff70ccd7e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/TextFormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/TextFormatPlugin.java @@ -17,9 +17,10 @@ */ package org.apache.drill.exec.store.easy.text; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.google.common.collect.Maps; -import com.google.common.base.Preconditions; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.SchemaPath; @@ -45,10 +46,9 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapred.FileSplit; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; public class TextFormatPlugin extends EasyFormatPlugin<TextFormatPlugin.TextFormatConfig> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java index 3981ee1ad..ab94727ac 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java @@ -26,7 +26,7 @@ public class InfoSchemaDrillTable extends DrillTable{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(InfoSchemaDrillTable.class); private final SelectedTable table; - + public InfoSchemaDrillTable(InfoSchemaStoragePlugin plugin, String storageEngineName, SelectedTable selection, StoragePluginConfig storageEngineConfig) { super(storageEngineName, plugin, selection); this.table = selection; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java index 0997152ec..f73bc050d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java @@ -22,8 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.google.common.collect.ImmutableList; - import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.Table; @@ -35,6 +33,7 @@ import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.store.AbstractSchema; import org.apache.drill.exec.store.AbstractStoragePlugin; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java index 00ab0a063..5ef8ad203 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/RecordGenerator.java @@ -17,12 +17,13 @@ */ package org.apache.drill.exec.store.ischema; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; +import java.util.List; + import net.hydromatic.optiq.Schema.TableType; import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.Table; import net.hydromatic.optiq.jdbc.JavaTypeFactoryImpl; + import org.apache.drill.exec.planner.logical.DrillViewInfoProvider; import org.apache.drill.exec.store.AbstractSchema; import org.apache.drill.exec.store.RecordReader; @@ -30,7 +31,8 @@ import org.apache.drill.exec.store.pojo.PojoRecordReader; import org.eigenbase.reltype.RelDataType; import org.eigenbase.reltype.RelDataTypeField; -import java.util.List; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; /** Generates records for POJO RecordReader by scanning the given schema */ public abstract class RecordGenerator { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java index 131e79502..5f562212b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java @@ -34,19 +34,19 @@ public enum SelectedTable{ VIEWS(new Views()), COLUMNS(new Columns()), TABLES(new Tables()); - + private final InfoSchemaTable tableDef; - + private SelectedTable(InfoSchemaTable tableDef) { this.tableDef = tableDef; } - + public RecordReader getRecordReader(SchemaPlus rootSchema) { RecordGenerator recordGenerator = tableDef.getRecordGenerator(); recordGenerator.scanSchema(rootSchema); return recordGenerator.getRecordReader(); } - + public RelDataType getRowType(RelDataTypeFactory typeFactory) { return tableDef.getRowType(typeFactory); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java index 80515fa48..21923d846 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java @@ -22,8 +22,6 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; -import javax.validation.constraints.Size; - import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockRecordReader.java index 0714ab840..66851a998 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockRecordReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockRecordReader.java @@ -17,9 +17,9 @@ */ package org.apache.drill.exec.store.mock; -import com.google.common.collect.Lists; +import java.util.Map; + import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.exception.SchemaChangeException; @@ -32,15 +32,11 @@ import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.MaterializedField.Key; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.store.RecordReader; import org.apache.drill.exec.store.mock.MockGroupScanPOP.MockColumn; import org.apache.drill.exec.store.mock.MockGroupScanPOP.MockScanEntry; import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.ValueVector; -import java.util.List; -import java.util.Map; - public class MockRecordReader extends AbstractRecordReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MockRecordReader.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java index 1adbacc43..51b22080c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockStorageEngine.java @@ -27,7 +27,6 @@ import org.apache.drill.common.JSONOptions; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.StoragePluginConfig; import org.apache.drill.exec.physical.base.AbstractGroupScan; -import org.apache.drill.exec.rpc.user.DrillUser; import org.apache.drill.exec.rpc.user.UserSession; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.store.AbstractStoragePlugin; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ColumnDataReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ColumnDataReader.java index 2567c8983..a461e5a7a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ColumnDataReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ColumnDataReader.java @@ -17,19 +17,14 @@ */ package org.apache.drill.exec.store.parquet; -import java.io.EOFException; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; -import java.nio.channels.Channels; -import java.nio.channels.WritableByteChannel; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.hadoop.fs.FSDataInputStream; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; import parquet.bytes.BytesInput; import parquet.format.PageHeader; @@ -38,16 +33,16 @@ import parquet.hadoop.util.CompatibilityUtil; public class ColumnDataReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ColumnDataReader.class); - + private final long endPosition; public final FSDataInputStream input; - + public ColumnDataReader(FSDataInputStream input, long start, long length) throws IOException{ this.input = input; this.input.seek(start); this.endPosition = start + length; } - + public PageHeader readPageHeader() throws IOException{ return Util.readPageHeader(input); } @@ -82,11 +77,11 @@ public class ColumnDataReader { public boolean hasRemainder() throws IOException{ return input.getPos() < endPosition; } - + public class HadoopBytesInput extends BytesInput{ private final byte[] pageBytes; - + public HadoopBytesInput(byte[] pageBytes) { super(); this.pageBytes = pageBytes; @@ -106,7 +101,7 @@ public class ColumnDataReader { public void writeAllTo(OutputStream out) throws IOException { out.write(pageBytes); } - + } } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetDirectByteBufferAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetDirectByteBufferAllocator.java index 1a49dcd77..45a1dc6a9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetDirectByteBufferAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetDirectByteBufferAllocator.java @@ -19,14 +19,16 @@ package org.apache.drill.exec.store.parquet; import io.netty.buffer.ByteBuf; -import org.apache.drill.exec.ops.OperatorContext; -import parquet.bytes.ByteBufferAllocator; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.apache.drill.exec.ops.OperatorContext; + +import parquet.bytes.ByteBufferAllocator; + public class ParquetDirectByteBufferAllocator implements ByteBufferAllocator { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParquetDirectByteBufferAllocator.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatConfig.java index d3200fe9a..74a90c06d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatConfig.java @@ -17,7 +17,6 @@ */ package org.apache.drill.exec.store.parquet; -import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.drill.common.logical.FormatPluginConfig; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -34,5 +33,5 @@ public class ParquetFormatConfig implements FormatPluginConfig{ public boolean equals(Object obj) { return obj instanceof ParquetFormatConfig; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java index eb07d79a9..109033a4e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetFormatPlugin.java @@ -29,7 +29,6 @@ import org.apache.drill.common.logical.StoragePluginConfig; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.base.AbstractWriter; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.impl.WriterRecordBatch; @@ -77,7 +76,7 @@ public class ParquetFormatPlugin implements FormatPlugin{ public ParquetFormatPlugin(String name, DrillbitContext context, DrillFileSystem fs, StoragePluginConfig storageConfig){ this(name, context, fs, storageConfig, new ParquetFormatConfig()); } - + public ParquetFormatPlugin(String name, DrillbitContext context, DrillFileSystem fs, StoragePluginConfig storageConfig, ParquetFormatConfig formatConfig){ this.context = context; this.codecFactoryExposer = new CodecFactoryExposer(fs.getUnderlying().getConf()); @@ -109,7 +108,7 @@ public class ParquetFormatPlugin implements FormatPlugin{ public boolean supportsRead() { return true; } - + @Override public Set<StoragePluginOptimizerRule> getOptimizerRules() { return ImmutableSet.of(); @@ -170,7 +169,7 @@ public class ParquetFormatPlugin implements FormatPlugin{ public String getName(){ return name; } - + @Override public boolean supportsWrite() { return false; @@ -184,9 +183,9 @@ public class ParquetFormatPlugin implements FormatPlugin{ } private static class ParquetFormatMatcher extends BasicFormatMatcher{ - + private final DrillFileSystem fs; - + public ParquetFormatMatcher(ParquetFormatPlugin plugin, DrillFileSystem fs) { super(plugin, fs, // Lists.newArrayList( // @@ -195,12 +194,12 @@ public class ParquetFormatPlugin implements FormatPlugin{ // ), Lists.newArrayList(new MagicString(0, ParquetFileWriter.MAGIC)) - + ); this.fs = fs; - + } - + @Override public boolean supportDirectoryReads() { return true; @@ -208,7 +207,7 @@ public class ParquetFormatPlugin implements FormatPlugin{ @Override public FormatSelection isReadable(FileSelection selection) throws IOException { - // TODO: we only check the first file for directory reading. This is because + // TODO: we only check the first file for directory reading. This is because if(selection.containsDirectories(fs)){ if(isDirReadable(selection.getFirstPath(fs))){ return new FormatSelection(plugin.getConfig(), selection); @@ -216,7 +215,7 @@ public class ParquetFormatPlugin implements FormatPlugin{ } return super.isReadable(selection); } - + boolean isDirReadable(FileStatus dir) { Path p = new Path(dir.getPath(), ParquetFileWriter.PARQUET_METADATA_FILE); try { @@ -237,9 +236,9 @@ public class ParquetFormatPlugin implements FormatPlugin{ return false; } } - - - + + + } - + }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java index bc8495cdb..a768fc9c8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetGroupScan.java @@ -390,6 +390,7 @@ public class ParquetGroupScan extends AbstractGroupScan { return newScan; } + @Override @JsonIgnore public boolean canPushdownProjects(List<SchemaPath> columns) { return true; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetRecordWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetRecordWriter.java index 2c5f232c8..5a6ba8082 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetRecordWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetRecordWriter.java @@ -17,7 +17,14 @@ */ package org.apache.drill.exec.store.parquet; -import com.google.common.collect.Lists; +import static java.lang.Math.max; +import static java.lang.Math.min; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.exec.ExecConstants; @@ -33,6 +40,7 @@ import org.apache.drill.exec.vector.complex.reader.FieldReader; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; + import parquet.column.ParquetProperties.WriterVersion; import parquet.column.impl.ColumnWriteStoreImpl; import parquet.column.page.PageWriteStore; @@ -51,14 +59,7 @@ import parquet.schema.PrimitiveType.PrimitiveTypeName; import parquet.schema.Type; import parquet.schema.Type.Repetition; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static java.lang.Math.max; -import static java.lang.Math.min; -import static java.lang.String.format; +import com.google.common.collect.Lists; public class ParquetRecordWriter extends ParquetOutputRecordWriter { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParquetRecordWriter.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java index f77ac9829..8aebab975 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetScanBatchCreator.java @@ -34,10 +34,6 @@ import org.apache.drill.exec.physical.impl.ScanBatch; import org.apache.drill.exec.record.RecordBatch; import org.apache.drill.exec.store.AbstractRecordReader; import org.apache.drill.exec.store.RecordReader; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; - import org.apache.drill.exec.store.parquet.columnreaders.ParquetRecordReader; import org.apache.drill.exec.store.parquet2.DrillParquetReader; import org.apache.hadoop.conf.Configuration; @@ -50,6 +46,9 @@ import parquet.hadoop.metadata.ParquetMetadata; import parquet.schema.MessageType; import parquet.schema.Type; +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; + public class ParquetScanBatchCreator implements BatchCreator<ParquetRowGroupScan>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParquetScanBatchCreator.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetWriterBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetWriterBatchCreator.java index 50ab94cbd..10dd26da8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetWriterBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/ParquetWriterBatchCreator.java @@ -17,13 +17,13 @@ */ package org.apache.drill.exec.store.parquet; +import java.util.List; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.impl.BatchCreator; import org.apache.drill.exec.record.RecordBatch; -import java.util.List; - public class ParquetWriterBatchCreator implements BatchCreator<ParquetWriter>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParquetWriterBatchCreator.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/BitReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/BitReader.java index 43e270af7..9aabc9c7c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/BitReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/BitReader.java @@ -18,9 +18,11 @@ package org.apache.drill.exec.store.parquet.columnreaders; import io.netty.buffer.ByteBuf; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.BaseDataValueVector; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; @@ -30,7 +32,7 @@ final class BitReader extends ColumnReader { private byte currentByte; private byte nextByte; private ByteBuf bytebuf; - + BitReader(ParquetRecordReader parentReader, int allocateSize, ColumnDescriptor descriptor, ColumnChunkMetaData columnChunkMetaData, boolean fixedLength, ValueVector v, SchemaElement schemaElement) throws ExecutionSetupException { super(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, v, schemaElement); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java index 272a5c352..b629ddad7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReader.java @@ -18,22 +18,24 @@ package org.apache.drill.exec.store.parquet.columnreaders; import io.netty.buffer.ByteBuf; + +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.BaseValueVector; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; import parquet.schema.PrimitiveType; import parquet.schema.PrimitiveType.PrimitiveTypeName; -import java.io.IOException; - public abstract class ColumnReader<V extends ValueVector> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ColumnReader.class); final ParquetRecordReader parentReader; - + // Value Vector for this column final V valueVec; @@ -57,10 +59,10 @@ public abstract class ColumnReader<V extends ValueVector> { // counter for the total number of values read from one or more pages // when a batch is filled all of these values should be the same for all of the columns int totalValuesRead; - + // counter for the values that have been read in this pass (a single call to the next() method) int valuesReadInCurrentPass; - + // length of single data value in bits, if the length is fixed int dataTypeLengthInBits; int bytesReadInCurrentPass; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReaderFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReaderFactory.java index a2a191dfe..f9a3c9f94 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReaderFactory.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReaderFactory.java @@ -19,7 +19,6 @@ package org.apache.drill.exec.store.parquet.columnreaders; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.exception.SchemaChangeException; - import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.Decimal28SparseVector; import org.apache.drill.exec.vector.Decimal38SparseVector; @@ -38,6 +37,7 @@ import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.VarBinaryVector; import org.apache.drill.exec.vector.VarCharVector; import org.apache.drill.exec.vector.VariableWidthVector; + import parquet.column.ColumnDescriptor; import parquet.column.Encoding; import parquet.format.ConvertedType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedByteAlignedReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedByteAlignedReader.java index bfbefdb8c..f467f8c54 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedByteAlignedReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedByteAlignedReader.java @@ -20,6 +20,8 @@ package org.apache.drill.exec.store.parquet.columnreaders; import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import java.math.BigDecimal; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.expr.holders.Decimal28SparseHolder; import org.apache.drill.exec.expr.holders.Decimal38SparseHolder; @@ -36,8 +38,6 @@ import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import java.math.BigDecimal; - class FixedByteAlignedReader extends ColumnReader { protected DrillBuf bytebuf; @@ -79,6 +79,7 @@ class FixedByteAlignedReader extends ColumnReader { castedVector = v; } + @Override protected void readField(long recordsToReadInThisPass) { // we can use the standard read method to transfer the data super.readField(recordsToReadInThisPass); @@ -101,6 +102,7 @@ class FixedByteAlignedReader extends ColumnReader { super(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, v, schemaElement); } + @Override public void writeData() { dataTypeLengthInBytes = (int) Math.ceil(dataTypeLengthInBits / 8.0); for (int i = 0; i < recordsReadInThisIteration; i++) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedWidthRepeatedReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedWidthRepeatedReader.java index 18618e612..2fc3d6ebe 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedWidthRepeatedReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/FixedWidthRepeatedReader.java @@ -17,15 +17,16 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; -import org.apache.drill.exec.vector.RepeatedFixedWidthVector; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; +import org.apache.drill.exec.vector.RepeatedFixedWidthVector; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import java.io.IOException; - public class FixedWidthRepeatedReader extends VarLengthColumn { RepeatedFixedWidthVector castedRepeatedVector; @@ -59,6 +60,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { notFishedReadingList = false; } + @Override public void reset() { bytesReadInCurrentPass = 0; valuesReadInCurrentPass = 0; @@ -68,6 +70,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { repeatedGroupsReadInCurrentPass = 0; } + @Override public int getRecordsReadInCurrentPass() { return repeatedGroupsReadInCurrentPass; } @@ -77,10 +80,12 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { //To change body of implemented methods use File | Settings | File Templates. } + @Override public boolean skipReadyToReadPositionUpdate() { return false; } + @Override public void updateReadyToReadPosition() { valuesToRead += repeatedValuesInCurrentList; pageReader.valuesReadyToRead += repeatedValuesInCurrentList; @@ -90,17 +95,20 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { repeatedValuesInCurrentList = -1; } + @Override public void updatePosition() { pageReader.readPosInBytes += dataTypeLengthInBits; bytesReadInCurrentPass += dataTypeLengthInBits; valuesReadInCurrentPass++; } + @Override public void hitRowGroupEnd() { pageReader.valuesReadyToRead = 0; definitionLevelsRead = 0; } + @Override public void postPageRead() { super.postPageRead(); // this is no longer correct as we figured out that lists can reach across pages @@ -109,6 +117,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { definitionLevelsRead = 0; } + @Override protected int totalValuesReadAndReadyToReadInPage() { // we need to prevent the page reader from getting rid of the current page in the case where we have a repeated // value split across a page boundary @@ -118,6 +127,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { return definitionLevelsRead; } + @Override protected boolean checkVectorCapacityReached() { boolean doneReading = super.checkVectorCapacityReached(); if (doneReading) @@ -128,6 +138,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { return false; } + @Override protected boolean readAndStoreValueSizeInformation() { boolean readingValsAcrossPageBoundary = false; int numLeftoverVals = 0; @@ -196,6 +207,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { return false; } + @Override protected void readRecords(int valuesToRead) { if (valuesToRead == 0) return; // TODO - validate that this works in all cases, it fixes a bug when reading from multiple pages into @@ -211,6 +223,7 @@ public class FixedWidthRepeatedReader extends VarLengthColumn { return castedRepeatedVector.getMutator().getDataVector().getData().capacity(); } + @Override public void clear() { super.clear(); dataReader.clear(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableBitReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableBitReader.java index fbf1dee2c..b9b808b50 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableBitReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableBitReader.java @@ -20,6 +20,7 @@ package org.apache.drill.exec.store.parquet.columnreaders; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.NullableBitVector; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java index 8551ee0d0..c7ada6bff 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableColumnReader.java @@ -17,16 +17,17 @@ */ package org.apache.drill.exec.store.parquet.columnreaders; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.BaseValueVector; import org.apache.drill.exec.vector.NullableVectorDefinitionSetter; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import java.io.IOException; - abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader<V>{ int nullsFound; @@ -48,6 +49,7 @@ abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader< } + @Override public void processPages(long recordsToReadInThisPass) throws IOException { int indexInOutputVector = 0; readStartInBytes = 0; @@ -138,5 +140,6 @@ abstract class NullableColumnReader<V extends ValueVector> extends ColumnReader< valuesReadInCurrentPass); } + @Override protected abstract void readField(long recordsToRead); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java index fc1df7994..63ac0eed1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java @@ -20,27 +20,27 @@ package org.apache.drill.exec.store.parquet.columnreaders; import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import java.math.BigDecimal; + import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.util.DecimalUtility; -import org.apache.drill.exec.vector.NullableBigIntVector; -import org.apache.drill.exec.vector.NullableFloat4Vector; -import org.apache.drill.exec.vector.NullableFloat8Vector; -import org.apache.drill.exec.vector.NullableIntVector; -import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.expr.holders.NullableDecimal28SparseHolder; import org.apache.drill.exec.expr.holders.NullableDecimal38SparseHolder; import org.apache.drill.exec.store.ParquetOutputRecordWriter; +import org.apache.drill.exec.util.DecimalUtility; +import org.apache.drill.exec.vector.NullableBigIntVector; import org.apache.drill.exec.vector.NullableDateVector; import org.apache.drill.exec.vector.NullableDecimal28SparseVector; import org.apache.drill.exec.vector.NullableDecimal38SparseVector; +import org.apache.drill.exec.vector.NullableFloat4Vector; +import org.apache.drill.exec.vector.NullableFloat8Vector; +import org.apache.drill.exec.vector.NullableIntVector; +import org.apache.drill.exec.vector.ValueVector; import org.joda.time.DateTimeUtils; import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import java.math.BigDecimal; - public class NullableFixedByteAlignedReaders { static class NullableFixedByteAlignedReader extends NullableColumnReader { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableVarLengthValuesColumn.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableVarLengthValuesColumn.java index 8bff0b0be..47d64bc90 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableVarLengthValuesColumn.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableVarLengthValuesColumn.java @@ -17,19 +17,17 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.ValueVector; -import parquet.bytes.BytesUtils; import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import java.io.IOException; - public abstract class NullableVarLengthValuesColumn<V extends ValueVector> extends VarLengthValuesColumn<V> { int nullsRead; @@ -41,10 +39,13 @@ public abstract class NullableVarLengthValuesColumn<V extends ValueVector> exten super(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, v, schemaElement); } + @Override public abstract boolean setSafe(int index, DrillBuf value, int start, int length); + @Override public abstract int capacity(); + @Override public void reset() { bytesReadInCurrentPass = 0; valuesReadInCurrentPass = 0; @@ -52,11 +53,13 @@ public abstract class NullableVarLengthValuesColumn<V extends ValueVector> exten pageReader.valuesReadyToRead = 0; } + @Override protected void postPageRead() { currLengthDeterminingDictVal = null; pageReader.valuesReadyToRead = 0; } + @Override protected boolean readAndStoreValueSizeInformation() throws IOException { // we need to read all of the lengths to determine if this value will fit in the current vector, // as we can only read each definition level once, we have to store the last one as we will need it @@ -95,6 +98,7 @@ public abstract class NullableVarLengthValuesColumn<V extends ValueVector> exten return false; } + @Override public void updateReadyToReadPosition() { if (! currentValNull){ pageReader.readyToReadPosInBytes += dataTypeLengthInBits + 4; @@ -103,6 +107,7 @@ public abstract class NullableVarLengthValuesColumn<V extends ValueVector> exten currLengthDeterminingDictVal = null; } + @Override public void updatePosition() { if (! currentValNull){ pageReader.readPosInBytes += dataTypeLengthInBits + 4; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java index 7b77e0cf6..ef30c1917 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/PageReader.java @@ -17,14 +17,13 @@ */ package org.apache.drill.exec.store.parquet.columnreaders; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.DrillBuf; + import java.io.IOException; import java.util.ArrayList; import java.util.List; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.DrillBuf; -import io.netty.buffer.Unpooled; - import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.store.parquet.ColumnDataReader; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetFixedWidthDictionaryReaders.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetFixedWidthDictionaryReaders.java index bad6e6a9d..02b583a47 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetFixedWidthDictionaryReaders.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetFixedWidthDictionaryReaders.java @@ -22,12 +22,10 @@ import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.Float4Vector; import org.apache.drill.exec.vector.Float8Vector; import org.apache.drill.exec.vector.IntVector; -import org.apache.drill.exec.vector.NullableIntVector; -import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; -import parquet.schema.PrimitiveType; public class ParquetFixedWidthDictionaryReaders { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetRecordReader.java index 9f2012a4f..bdfc860fd 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetRecordReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetRecordReader.java @@ -20,14 +20,9 @@ package org.apache.drill.exec.store.parquet.columnreaders; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.SchemaPath; @@ -40,31 +35,29 @@ import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.OperatorContext; -import org.apache.drill.exec.physical.base.GroupScan; import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.MaterializedField.Key; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.store.RecordReader; -import org.apache.drill.exec.vector.NullableBitVector; import org.apache.drill.exec.vector.AllocationHelper; -import org.apache.drill.exec.vector.ValueVector; +import org.apache.drill.exec.vector.NullableBitVector; import org.apache.drill.exec.vector.RepeatedFixedWidthVector; +import org.apache.drill.exec.vector.ValueVector; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import parquet.column.ColumnDescriptor; -import parquet.format.ConvertedType; import parquet.format.FileMetaData; import parquet.format.SchemaElement; import parquet.format.converter.ParquetMetadataConverter; import parquet.hadoop.CodecFactoryExposer; import parquet.hadoop.ParquetFileWriter; -import parquet.hadoop.metadata.BlockMetaData; import parquet.hadoop.metadata.ColumnChunkMetaData; import parquet.hadoop.metadata.ParquetMetadata; import parquet.schema.PrimitiveType; +import com.google.common.collect.Lists; + public class ParquetRecordReader extends AbstractRecordReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParquetRecordReader.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetToDrillTypeConverter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetToDrillTypeConverter.java index 481b28956..15f648c04 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetToDrillTypeConverter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ParquetToDrillTypeConverter.java @@ -17,12 +17,13 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; -import org.apache.drill.common.types.TypeProtos; -import static org.apache.drill.common.types.TypeProtos.MinorType; -import static org.apache.drill.common.types.TypeProtos.DataMode; import static parquet.Preconditions.checkArgument; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.TypeProtos.DataMode; +import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; + import parquet.format.ConvertedType; import parquet.format.SchemaElement; import parquet.schema.PrimitiveType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumn.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumn.java index 14ee6318a..8e72bffbe 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumn.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumn.java @@ -17,16 +17,17 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.ValueVector; + import parquet.column.ColumnDescriptor; import parquet.format.Encoding; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; import parquet.io.api.Binary; -import java.io.IOException; - public abstract class VarLengthColumn<V extends ValueVector> extends ColumnReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VarLengthColumn.class); @@ -44,10 +45,12 @@ public abstract class VarLengthColumn<V extends ValueVector> extends ColumnReade } } + @Override protected boolean processPageData(int recordsToReadInThisPass) throws IOException { return readAndStoreValueSizeInformation(); } + @Override public void reset() { super.reset(); pageReader.valuesReadyToRead = 0; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumnReaders.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumnReaders.java index 2f3711dc1..99e6f539a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumnReaders.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthColumnReaders.java @@ -17,9 +17,7 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; -import io.netty.buffer.Unpooled; import java.math.BigDecimal; @@ -27,7 +25,6 @@ import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.expr.holders.Decimal28SparseHolder; import org.apache.drill.exec.expr.holders.Decimal38SparseHolder; import org.apache.drill.exec.expr.holders.NullableVarBinaryHolder; -import org.apache.drill.exec.expr.holders.NullableVarCharHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; import org.apache.drill.exec.util.DecimalUtility; @@ -225,6 +222,7 @@ public class VarLengthColumnReaders { this.mutator = vector.getMutator(); } + @Override public boolean setSafe(int index, DrillBuf value, int start, int length) { boolean success; if(index >= vector.getValueCapacity()) return false; @@ -302,6 +300,7 @@ public class VarLengthColumnReaders { nullableVarBinaryVector = v; } + @Override public boolean setSafe(int index, DrillBuf value, int start, int length) { boolean success; if(index >= nullableVarBinaryVector.getValueCapacity()) return false; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthValuesColumn.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthValuesColumn.java index 4f02c7010..7c4b33b02 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthValuesColumn.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLengthValuesColumn.java @@ -17,22 +17,20 @@ ******************************************************************************/ package org.apache.drill.exec.store.parquet.columnreaders; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import java.io.IOException; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.VariableWidthVector; -import parquet.bytes.BytesUtils; import parquet.column.ColumnDescriptor; import parquet.format.Encoding; import parquet.format.SchemaElement; import parquet.hadoop.metadata.ColumnChunkMetaData; import parquet.io.api.Binary; -import java.io.IOException; - public abstract class VarLengthValuesColumn<V extends ValueVector> extends VarLengthColumn { Binary currLengthDeterminingDictVal; @@ -64,22 +62,26 @@ public abstract class VarLengthValuesColumn<V extends ValueVector> extends VarLe updatePosition(); } + @Override public void updateReadyToReadPosition() { pageReader.readyToReadPosInBytes += dataTypeLengthInBits + 4; pageReader.valuesReadyToRead++; currLengthDeterminingDictVal = null; } + @Override public void updatePosition() { pageReader.readPosInBytes += dataTypeLengthInBits + 4; bytesReadInCurrentPass += dataTypeLengthInBits; valuesReadInCurrentPass++; } + @Override public boolean skipReadyToReadPositionUpdate() { return false; } + @Override protected boolean readAndStoreValueSizeInformation() throws IOException { // re-purposing this field here for length in BYTES to prevent repetitive multiplication/division if (usingDictionary) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java index 14075f3a4..6ce4e2073 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetReader.java @@ -17,10 +17,13 @@ */ package org.apache.drill.exec.store.parquet2; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.expression.SchemaPath; @@ -29,17 +32,16 @@ import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField.Key; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.store.RecordReader; import org.apache.drill.exec.store.parquet.RowGroupReadEntry; import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.BaseValueVector; -import org.apache.drill.exec.vector.RepeatedFixedWidthVector; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.VariableWidthVector; import org.apache.drill.exec.vector.complex.impl.VectorContainerWriter; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; + import parquet.hadoop.CodecFactoryExposer; import parquet.hadoop.ColumnChunkIncReadStore; import parquet.hadoop.metadata.BlockMetaData; @@ -53,12 +55,8 @@ import parquet.schema.GroupType; import parquet.schema.MessageType; import parquet.schema.Type; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; public class DrillParquetReader extends AbstractRecordReader { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/AbstractWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/AbstractWriter.java index 0c9a1cd5a..c41a07aa7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/AbstractWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/AbstractWriter.java @@ -24,7 +24,6 @@ import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField; -import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.ValueVector; abstract class AbstractWriter<V extends ValueVector> implements PojoWriter{ diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/Writers.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/Writers.java index 8227695e8..b982c9e1d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/Writers.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/Writers.java @@ -117,6 +117,7 @@ public class Writers { data = data.reallocIfNeeded(len); } + @Override public void cleanup(){ } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java index 56d048558..fea0875bb 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AffinityCreator.java @@ -23,23 +23,23 @@ import java.util.concurrent.TimeUnit; import org.apache.drill.exec.physical.EndpointAffinity; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; -import com.google.common.collect.Lists; import com.carrotsearch.hppc.ObjectFloatOpenHashMap; import com.carrotsearch.hppc.cursors.ObjectFloatCursor; import com.carrotsearch.hppc.cursors.ObjectLongCursor; import com.google.common.base.Stopwatch; +import com.google.common.collect.Lists; public class AffinityCreator { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AffinityCreator.class); - + public static <T extends CompleteWork> List<EndpointAffinity> getAffinityMap(List<T> work){ Stopwatch watch = new Stopwatch(); - + long totalBytes = 0; for (CompleteWork entry : work) { totalBytes += entry.getTotalBytes(); } - + ObjectFloatOpenHashMap<DrillbitEndpoint> affinities = new ObjectFloatOpenHashMap<DrillbitEndpoint>(); for (CompleteWork entry : work) { for (ObjectLongCursor<DrillbitEndpoint> cursor : entry.getByteMap()) { @@ -49,7 +49,7 @@ public class AffinityCreator { affinities.putOrAdd(cursor.key, affinity, affinity); } } - + List<EndpointAffinity> affinityList = Lists.newLinkedList(); for (ObjectFloatCursor<DrillbitEndpoint> d : affinities) { logger.debug("Endpoint {} has affinity {}", d.key.getAddress(), d.value); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java index 4610d88c5..705688ee5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java @@ -41,18 +41,18 @@ public class AssignmentCreator<T extends CompleteWork> { private final ArrayListMultimap<Integer, T> mappings; private final List<DrillbitEndpoint> endpoints; - + /** * Given a set of endpoints to assign work to, attempt to evenly assign work based on affinity of work units to * Drillbits. - * + * * @param incomingEndpoints * The set of nodes to assign work to. Note that nodes can be listed multiple times if we want to have * multiple slices on a node working on the task simultaneously. * @param units * The work units to assign. - * @return ListMultimap of Integer > List<CompleteWork> (based on their incoming order) to with + * @return ListMultimap of Integer > List<CompleteWork> (based on their incoming order) to with */ public static <T extends CompleteWork> ListMultimap<Integer, T> getMappings(List<DrillbitEndpoint> incomingEndpoints, List<T> units) { @@ -63,7 +63,7 @@ public class AssignmentCreator<T extends CompleteWork> { private AssignmentCreator(List<DrillbitEndpoint> incomingEndpoints, List<T> units) { logger.debug("Assigning {} units to {} endpoints", units.size(), incomingEndpoints.size()); Stopwatch watch = new Stopwatch(); - + Preconditions.checkArgument(incomingEndpoints.size() <= units.size(), String.format("Incoming endpoints %d " + "is greater than number of row groups %d", incomingEndpoints.size(), units.size())); this.mappings = ArrayListMultimap.create(); @@ -83,7 +83,7 @@ public class AssignmentCreator<T extends CompleteWork> { } /** - * + * * @param mappings * the mapping between fragment/endpoint and rowGroup * @param endpoints diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java index 3c5d9a4a2..149f9e1f8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/BlockMapBuilder.java @@ -33,14 +33,14 @@ import org.apache.hadoop.fs.BlockLocation; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.io.compress.CompressionCodecFactory; -import com.google.common.collect.Lists; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableRangeMap; +import com.google.common.collect.Lists; import com.google.common.collect.Range; -import org.apache.hadoop.io.compress.CompressionCodecFactory; public class BlockMapBuilder { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BlockMapBuilder.class); @@ -87,7 +87,7 @@ public class BlockMapBuilder { } return work; } - + private class FileStatusWork implements FileWork{ private FileStatus status; @@ -110,16 +110,16 @@ public class BlockMapBuilder { public long getLength() { return status.getLen(); } - - - + + + } - + private ImmutableRangeMap<Long,BlockLocation> buildBlockMap(Path path) throws IOException { FileStatus status = fs.getFileStatus(path); return buildBlockMap(status); } - + /** * Builds a mapping of block locations to file byte range */ @@ -140,7 +140,7 @@ public class BlockMapBuilder { context.stop(); return blockMap; } - + private ImmutableRangeMap<Long,BlockLocation> getBlockMap(Path path) throws IOException{ ImmutableRangeMap<Long,BlockLocation> blockMap = blockMapMap.get(path); if(blockMap == null) { @@ -148,7 +148,7 @@ public class BlockMapBuilder { } return blockMap; } - + private ImmutableRangeMap<Long,BlockLocation> getBlockMap(FileStatus status) throws IOException{ ImmutableRangeMap<Long,BlockLocation> blockMap = blockMapMap.get(status.getPath()); if(blockMap == null){ @@ -157,19 +157,19 @@ public class BlockMapBuilder { return blockMap; } - + /** * For a given FileWork, calculate how many bytes are available on each on drillbit endpoint * * @param work the FileWork to calculate endpoint bytes for - * @throws IOException + * @throws IOException */ public EndpointByteMap getEndpointByteMap(FileWork work) throws IOException { Stopwatch watch = new Stopwatch(); watch.start(); Path fileName = new Path(work.getPath()); - - + + ImmutableRangeMap<Long,BlockLocation> blockMap = getBlockMap(fileName); EndpointByteMapImpl endpointByteMap = new EndpointByteMapImpl(); long start = work.getStart(); @@ -203,7 +203,7 @@ public class BlockMapBuilder { } logger.debug("FileWork group ({},{}) max bytes {}", work.getPath(), work.getStart(), endpointByteMap.getMaxBytes()); - + logger.debug("Took {} ms to set endpoint bytes", watch.stop().elapsed(TimeUnit.MILLISECONDS)); return endpointByteMap; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteFileWork.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteFileWork.java index cfa4fcb71..04838bd3f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteFileWork.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteFileWork.java @@ -29,7 +29,7 @@ public class CompleteFileWork implements FileWork, CompleteWork{ private long length; private String path; private EndpointByteMap byteMap; - + public CompleteFileWork(EndpointByteMap byteMap, long start, long length, String path) { super(); this.start = start; @@ -67,11 +67,11 @@ public class CompleteFileWork implements FileWork, CompleteWork{ public long getLength() { return length; } - + public FileWorkImpl getAsFileWork(){ return new FileWorkImpl(start, length, path); } - + public static class FileWorkImpl implements FileWork{ @JsonCreator @@ -85,7 +85,7 @@ public class CompleteFileWork implements FileWork, CompleteWork{ public long start; public long length; public String path; - + @Override public String getPath() { return path; @@ -100,7 +100,7 @@ public class CompleteFileWork implements FileWork, CompleteWork{ public long getLength() { return length; } - + } @Override diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteWork.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteWork.java index 44e27d45e..52cf0f732 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteWork.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/CompleteWork.java @@ -23,7 +23,7 @@ package org.apache.drill.exec.store.schedule; */ public interface CompleteWork extends Comparable<CompleteWork>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CompleteWork.class); - + public long getTotalBytes(); public EndpointByteMap getByteMap(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/EndpointByteMapImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/EndpointByteMapImpl.java index 64e52eb0c..567175d40 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/EndpointByteMapImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/EndpointByteMapImpl.java @@ -26,23 +26,23 @@ import com.carrotsearch.hppc.cursors.ObjectLongCursor; public class EndpointByteMapImpl implements EndpointByteMap{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(EndpointByteMapImpl.class); - + private final ObjectLongOpenHashMap<DrillbitEndpoint> map = new ObjectLongOpenHashMap<>(); - + private long maxBytes; - + public boolean isSet(DrillbitEndpoint endpoint){ return map.containsKey(endpoint); } - + public long get(DrillbitEndpoint endpoint){ return map.get(endpoint); } - + public boolean isEmpty(){ return map.isEmpty(); } - + public void add(DrillbitEndpoint endpoint, long bytes){ assert endpoint != null; maxBytes = Math.max(maxBytes, map.putOrAdd(endpoint, bytes, bytes)+1); @@ -56,6 +56,6 @@ public class EndpointByteMapImpl implements EndpointByteMap{ public Iterator<ObjectLongCursor<DrillbitEndpoint>> iterator() { return map.iterator(); } - - + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/PartialWork.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/PartialWork.java index bb8d9508b..8080747b1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/PartialWork.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/PartialWork.java @@ -21,23 +21,23 @@ import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; public class PartialWork { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PartialWork.class); - + private final long length; private final DrillbitEndpoint[] locations; - + public PartialWork(long length, DrillbitEndpoint[] locations) { super(); this.length = length; this.locations = locations; } - + public long getLength() { return length; } public DrillbitEndpoint[] getLocations() { return locations; } - - - + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java index 4fe23aa71..580d20ad6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java @@ -54,7 +54,7 @@ public class PStoreRegistry { Class<? extends PStoreProvider> storeProviderClass = (Class<? extends PStoreProvider>) Class.forName(storeProviderClassName); Constructor<? extends PStoreProvider> c = storeProviderClass.getConstructor(PStoreRegistry.class); return c.newInstance(this); - } catch (ConfigException.Missing | ClassNotFoundException | NoSuchMethodException | SecurityException + } catch (ConfigException.Missing | ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error(e.getMessage(), e); throw new ExecutionSetupException("A System Table provider was either not specified or could not be found or instantiated", e); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTablePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTablePlugin.java index 4abd253b0..743ab53c0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTablePlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTablePlugin.java @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import com.google.common.collect.ImmutableList; import net.hydromatic.optiq.SchemaPlus; import org.apache.drill.common.JSONOptions; @@ -34,13 +33,13 @@ import org.apache.drill.exec.planner.logical.DrillTable; import org.apache.drill.exec.rpc.user.UserSession; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.server.options.DrillConfigIterator; -import org.apache.drill.exec.server.options.OptionValue; import org.apache.drill.exec.store.AbstractSchema; import org.apache.drill.exec.store.AbstractStoragePlugin; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; public class SystemTablePlugin extends AbstractStoragePlugin{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SystemTablePlugin.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTableScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTableScan.java index d260927b4..76da554f5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTableScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/SystemTableScan.java @@ -29,7 +29,6 @@ import org.apache.drill.exec.physical.base.AbstractGroupScan; import org.apache.drill.exec.physical.base.GroupScan; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.ScanStats; -import org.apache.drill.exec.physical.base.ScanStats.GroupScanProperty; import org.apache.drill.exec.physical.base.SubScan; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.proto.UserBitShared.CoreOperatorType; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java index ef65f2a3a..7b8761cc8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.util.Collections; import java.util.List; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.expression.FieldReference; @@ -31,14 +29,11 @@ import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.types.Types; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.exception.SchemaChangeException; -import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.store.RecordReader; -import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.RepeatedVarCharVector; import org.apache.drill.exec.vector.ValueVector; import org.apache.hadoop.io.LongWritable; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordWriter.java index 23d95b8c0..b713a0c70 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordWriter.java @@ -23,7 +23,6 @@ import java.io.PrintStream; import java.util.List; import java.util.Map; -import org.apache.drill.exec.expr.holders.ComplexHolder; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.store.EventBasedRecordWriter.FieldConverter; import org.apache.drill.exec.store.StringOutputRecordWriter; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/AssertionUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/AssertionUtil.java index a10038a01..e035e6be3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/AssertionUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/AssertionUtil.java @@ -19,16 +19,16 @@ package org.apache.drill.exec.util; public class AssertionUtil { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AssertionUtil.class); - - + + private static final boolean ASSERT_ENABLED; - + static{ boolean isAssertEnabled = false; assert isAssertEnabled = true; ASSERT_ENABLED = isAssertEnabled; } - + public static boolean isAssertionsEnabled(){ return ASSERT_ENABLED; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/AtomicState.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/AtomicState.java index 2df199d8b..ec498d453 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/AtomicState.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/AtomicState.java @@ -27,9 +27,9 @@ import com.google.protobuf.Internal.EnumLite; */ public abstract class AtomicState<T extends EnumLite> { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AtomicState.class); - + private final AtomicInteger state = new AtomicInteger(); - + /** * Constructor that defines initial T state. * @param initial @@ -37,11 +37,11 @@ public abstract class AtomicState<T extends EnumLite> { public AtomicState(T initial){ state.set(initial.getNumber()); } - + protected abstract T getStateFromNumber(int i); - + /** - * Does an atomic conditional update from one state to another. + * Does an atomic conditional update from one state to another. * @param oldState The expected current state. * @param newState The desired new state. * @return Whether or not the update was successful. @@ -49,7 +49,7 @@ public abstract class AtomicState<T extends EnumLite> { public boolean updateState(T oldState, T newState){ return state.compareAndSet(oldState.getNumber(), newState.getNumber()); } - + public T getState(){ return getStateFromNumber(state.get()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java index 6222514bb..1029e6149 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java @@ -17,18 +17,15 @@ */ package org.apache.drill.exec.util; -import com.google.common.collect.Lists; +import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.drill.common.expression.ExpressionStringBuilder; -import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.selection.SelectionVector4; -import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.vector.ValueVector; -import java.util.List; +import com.google.common.collect.Lists; /** * This is a tool for printing the content of record batches to screen. Used for debugging. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/DecimalUtility.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/DecimalUtility.java index 3d0a9de9c..a697d0352 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/DecimalUtility.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/DecimalUtility.java @@ -23,7 +23,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; -import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.util.CoreDecimalUtility; import org.apache.drill.exec.expr.fn.impl.ByteFunctionHelpers; import org.apache.drill.exec.expr.holders.Decimal38SparseHolder; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java index 88478f217..d1f4c089f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringArrayList.java @@ -17,12 +17,13 @@ */ package org.apache.drill.exec.util; +import java.util.ArrayList; + +import org.apache.hadoop.io.Text; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; -import org.apache.hadoop.io.Text; - -import java.util.ArrayList; public class JsonStringArrayList<E> extends ArrayList<E> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java index 507cb28e6..7ec870fc9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/JsonStringHashMap.java @@ -17,14 +17,13 @@ */ package org.apache.drill.exec.util; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; +import java.util.LinkedHashMap; import org.apache.hadoop.io.Text; -import java.util.HashMap; -import java.util.LinkedHashMap; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; /* * Simple class that extends the regular java.util.HashMap but overrides the diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/TextSerializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/TextSerializer.java index 3070592b4..87df102b1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/TextSerializer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/TextSerializer.java @@ -17,13 +17,14 @@ */ package org.apache.drill.exec.util; +import java.io.IOException; + +import org.apache.hadoop.io.Text; + import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import org.apache.hadoop.io.Text; - -import java.io.IOException; public class TextSerializer extends StdSerializer<Text> { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java index 81fce5dd9..c0fb57251 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java @@ -19,13 +19,13 @@ package org.apache.drill.exec.util; import java.util.List; -import com.google.common.base.Joiner; import org.apache.commons.lang.StringUtils; import org.apache.drill.common.util.DrillStringUtils; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorWrapper; +import com.google.common.base.Joiner; import com.google.common.collect.Lists; public class VectorUtil { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java index 5db0299c3..94e8300ca 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BaseDataValueVector.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.vector; import io.netty.buffer.DrillBuf; -import io.netty.buffer.DrillBuf; import java.util.Iterator; @@ -55,10 +54,12 @@ public abstract class BaseDataValueVector extends BaseValueVector{ } } + @Override public void setCurrentValueCount(int count) { currentValueCount = count; } + @Override public int getCurrentValueCount() { return currentValueCount; } @@ -90,6 +91,7 @@ public abstract class BaseDataValueVector extends BaseValueVector{ @Override public abstract SerializedField getMetadata(); + @Override public DrillBuf getData(){ return data; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java index 82cc4c908..a28f91949 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/BitVector.java @@ -269,6 +269,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe return new Boolean(get(index) != 0); } + @Override public final int getValueCount() { return valueCount; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/CopyUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/CopyUtil.java index c68f62f49..1ed7f3737 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/CopyUtil.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/CopyUtil.java @@ -17,14 +17,15 @@ */ package org.apache.drill.exec.vector; -import com.sun.codemodel.JExpr; -import com.sun.codemodel.JExpression; -import com.sun.codemodel.JVar; import org.apache.drill.exec.expr.ClassGenerator; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorWrapper; +import com.sun.codemodel.JExpr; +import com.sun.codemodel.JExpression; +import com.sun.codemodel.JVar; + public class CopyUtil { public static void generateCopies(ClassGenerator g, VectorAccessible batch, boolean hyper){ // we have parallel ids for each value vector so we don't actually have to deal with managing the ids at all. diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java index 032ccc243..b68f08941 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ObjectVector.java @@ -17,9 +17,12 @@ */ package org.apache.drill.exec.vector; -import io.netty.buffer.ByteBuf; import io.netty.buffer.DrillBuf; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.apache.drill.common.expression.FieldReference; import org.apache.drill.exec.expr.holders.ObjectHolder; import org.apache.drill.exec.memory.BufferAllocator; @@ -29,10 +32,6 @@ import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.TransferPair; import org.apache.drill.exec.vector.complex.reader.FieldReader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - public class ObjectVector extends BaseValueVector{ private Accessor accessor = new Accessor(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java index 3433537ac..df6a4860b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueVector.java @@ -22,7 +22,6 @@ import io.netty.buffer.DrillBuf; import java.io.Closeable; import org.apache.drill.common.expression.FieldReference; -import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.OutOfMemoryRuntimeException; import org.apache.drill.exec.proto.UserBitShared.SerializedField; import org.apache.drill.exec.record.MaterializedField; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/VectorTrimmer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/VectorTrimmer.java index 619dd9524..7f977f239 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/VectorTrimmer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/VectorTrimmer.java @@ -17,8 +17,8 @@ */ package org.apache.drill.exec.vector; -import io.netty.buffer.DrillBuf; import io.netty.buffer.ByteBuf; +import io.netty.buffer.DrillBuf; public class VectorTrimmer { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(VectorTrimmer.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/AbstractSqlAccessor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/AbstractSqlAccessor.java index 988461299..1605c7d93 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/AbstractSqlAccessor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/AbstractSqlAccessor.java @@ -28,60 +28,60 @@ import java.sql.Timestamp; import org.apache.drill.common.types.TypeProtos.MajorType; abstract class AbstractSqlAccessor implements SqlAccessor { - + @Override public abstract boolean isNull(int index); - + @Override public BigDecimal getBigDecimal(int index) throws InvalidAccessException{ throw new InvalidAccessException("BigDecimal"); } - + @Override public boolean getBoolean(int index) throws InvalidAccessException{ throw new InvalidAccessException("boolean"); } - + @Override public byte getByte(int index) throws InvalidAccessException{ throw new InvalidAccessException("byte"); } - + @Override public byte[] getBytes(int index) throws InvalidAccessException{ throw new InvalidAccessException("byte[]"); } - + @Override public Date getDate(int index) throws InvalidAccessException{ throw new InvalidAccessException("Date"); } - + @Override public double getDouble(int index) throws InvalidAccessException{ throw new InvalidAccessException("double"); } - + @Override public float getFloat(int index) throws InvalidAccessException{ throw new InvalidAccessException("float"); } - + @Override public int getInt(int index) throws InvalidAccessException{ throw new InvalidAccessException("int"); } - + @Override public long getLong(int index) throws InvalidAccessException{ throw new InvalidAccessException("long"); } - + @Override public short getShort(int index) throws InvalidAccessException{ throw new InvalidAccessException("short"); } - + @Override public InputStream getStream(int index) throws InvalidAccessException{ throw new InvalidAccessException("InputStream"); @@ -91,8 +91,8 @@ abstract class AbstractSqlAccessor implements SqlAccessor { public char getChar(int index) throws InvalidAccessException{ throw new InvalidAccessException("Char"); } - - @Override + + @Override public Reader getReader(int index) throws InvalidAccessException{ throw new InvalidAccessException("Reader"); } @@ -113,8 +113,8 @@ abstract class AbstractSqlAccessor implements SqlAccessor { } abstract MajorType getType(); - - + + public class InvalidAccessException extends SQLException{ public InvalidAccessException(String name){ super(String.format("Requesting class of type %s for an object of type %s:%s is not allowed.", name, getType().getMinorType().name(), getType().getMode().name())); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/SqlAccessor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/SqlAccessor.java index 56113540f..b8480b439 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/SqlAccessor.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/SqlAccessor.java @@ -45,7 +45,7 @@ public interface SqlAccessor { public abstract float getFloat(int index) throws InvalidAccessException; public abstract char getChar(int index) throws InvalidAccessException; - + public abstract int getInt(int index) throws InvalidAccessException; public abstract long getLong(int index) throws InvalidAccessException; @@ -55,13 +55,13 @@ public interface SqlAccessor { public abstract InputStream getStream(int index) throws InvalidAccessException; public abstract Reader getReader(int index) throws InvalidAccessException; - + public abstract String getString(int index) throws InvalidAccessException; public abstract Time getTime(int index) throws InvalidAccessException; public abstract Timestamp getTimestamp(int index) throws InvalidAccessException; - + public abstract Object getObject(int index) throws InvalidAccessException; }
\ No newline at end of file diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/sql/TimePrintMillis.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/sql/TimePrintMillis.java index 372bd8632..349abd550 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/sql/TimePrintMillis.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/accessor/sql/TimePrintMillis.java @@ -17,10 +17,10 @@ */ package org.apache.drill.exec.vector.accessor.sql; -import org.apache.drill.exec.expr.fn.impl.DateUtility; - import java.sql.Time; +import org.apache.drill.exec.expr.fn.impl.DateUtility; + public class TimePrintMillis extends Time { public TimePrintMillis(long time) { diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/FixedVectorAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/FixedVectorAllocator.java index 7b1351db8..e783d02f7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/FixedVectorAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/FixedVectorAllocator.java @@ -27,6 +27,7 @@ public class FixedVectorAllocator extends VectorAllocator{ this.out = out; } + @Override public void alloc(int recordCount){ out.allocateNew(recordCount); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVariableEstimatedAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVariableEstimatedAllocator.java index 2a0ca6595..c2346877b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVariableEstimatedAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVariableEstimatedAllocator.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.vector.allocator; import org.apache.drill.exec.vector.RepeatedVariableWidthVector; -import org.apache.drill.exec.vector.VariableWidthVector; public class RepeatedVariableEstimatedAllocator extends VectorAllocator{ RepeatedVariableWidthVector out; @@ -29,7 +28,8 @@ public class RepeatedVariableEstimatedAllocator extends VectorAllocator{ this.out = out; this.avgWidth = avgWidth; } - + + @Override public void alloc(int recordCount){ out.allocateNew(avgWidth * recordCount, recordCount, recordCount); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVectorAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVectorAllocator.java index 95c1d4c17..b4428df2a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVectorAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/RepeatedVectorAllocator.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.vector.allocator; import org.apache.drill.exec.vector.RepeatedVariableWidthVector; -import org.apache.drill.exec.vector.VariableWidthVector; class RepeatedVectorAllocator extends VectorAllocator{ RepeatedVariableWidthVector in; @@ -30,6 +29,7 @@ class RepeatedVectorAllocator extends VectorAllocator{ this.out = out; } + @Override public void alloc(int recordCount){ out.allocateNew(in.getByteCapacity(), in.getAccessor().getValueCount(), in.getAccessor().getValueCount()); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableEstimatedVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableEstimatedVector.java index b86158282..815a5317f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableEstimatedVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableEstimatedVector.java @@ -29,6 +29,7 @@ public class VariableEstimatedVector extends VectorAllocator{ this.avgWidth = avgWidth; } + @Override public void alloc(int recordCount){ out.allocateNew(avgWidth * recordCount, recordCount); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableVectorAllocator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableVectorAllocator.java index 47286ae5b..7934ecb5d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableVectorAllocator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/allocator/VariableVectorAllocator.java @@ -29,6 +29,7 @@ class VariableVectorAllocator extends VectorAllocator{ this.out = out; } + @Override public void alloc(int recordCount){ out.allocateNew(in.getByteCapacity(), recordCount); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java index 5eb135898..a6df3a36c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.vector.complex; +import java.util.List; + import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; @@ -24,8 +26,6 @@ import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.vector.ValueVector; -import java.util.List; - public abstract class AbstractContainerVector implements ValueVector{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractContainerVector.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java index 834719cd1..85067a1f5 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java @@ -41,12 +41,11 @@ import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.complex.RepeatedMapVector.MapSingleCopier; import org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl; import org.apache.drill.exec.vector.complex.reader.FieldReader; -import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter; import com.carrotsearch.hppc.IntObjectOpenHashMap; import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; public class MapVector extends AbstractContainerVector { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(MapVector.class); @@ -72,6 +71,7 @@ public class MapVector extends AbstractContainerVector { this.allocator = allocator; } + @Override public int size(){ return vectors.size(); } @@ -405,6 +405,7 @@ public class MapVector extends AbstractContainerVector { } } + @Override public VectorWithOrdinal getVectorWithOrdinal(String name){ return vectorIds.get(name); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java index fef416f82..dd3131659 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedListVector.java @@ -46,8 +46,8 @@ import org.apache.drill.exec.vector.complex.impl.NullReader; import org.apache.drill.exec.vector.complex.impl.RepeatedListReaderImpl; import org.apache.drill.exec.vector.complex.reader.FieldReader; -import com.google.common.collect.Lists; import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; public class RepeatedListVector extends AbstractContainerVector implements RepeatedFixedWidthVector{ @@ -74,6 +74,7 @@ public class RepeatedListVector extends AbstractContainerVector implements Repea this.field = field; } + @Override public int size(){ return vector != null ? 1 : 0; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java index 678439b4c..df5fdaa5f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java @@ -91,6 +91,7 @@ public class RepeatedMapVector extends AbstractContainerVector implements Repeat return vectors.keySet().iterator(); } + @Override public int size(){ return vectors.size(); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/JsonReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/JsonReader.java index fa26b5416..84c4902ef 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/JsonReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/JsonReader.java @@ -18,10 +18,6 @@ package org.apache.drill.exec.vector.complex.fn; import io.netty.buffer.DrillBuf; -import com.google.common.base.Preconditions; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.buffer.UnpooledByteBufAllocator; import java.io.IOException; import java.io.Reader; @@ -36,9 +32,7 @@ import org.apache.drill.exec.expr.holders.BitHolder; import org.apache.drill.exec.expr.holders.Float8Holder; import org.apache.drill.exec.expr.holders.VarCharHolder; import org.apache.drill.exec.physical.base.GroupScan; -import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.store.AbstractRecordReader; -import org.apache.drill.exec.vector.complex.writer.BaseWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter; @@ -49,6 +43,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.core.JsonToken; import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; public class JsonReader { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JsonReader.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/UTF8JsonRecordSplitter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/UTF8JsonRecordSplitter.java index ee9401527..3dca86e7a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/UTF8JsonRecordSplitter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/UTF8JsonRecordSplitter.java @@ -21,7 +21,6 @@ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java index 8f892e73a..468ea0f86 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/AbstractBaseReader.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.vector.complex.impl; import java.util.Iterator; -import java.util.Map.Entry; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.exec.vector.complex.reader.FieldReader; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java index 165c5b590..9f934b710 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/ComplexWriterImpl.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.vector.complex.impl; import org.apache.drill.common.types.TypeProtos.MajorType; import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; -import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.vector.ValueVector; @@ -87,6 +86,7 @@ public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWri } } + @Override public void setPosition(int index){ super.setPosition(index); switch(mode){ @@ -176,7 +176,7 @@ public class ComplexWriterImpl extends AbstractFieldWriter implements ComplexWri private static class VectorAccessibleFacade extends MapVector { private final VectorContainer vc; - + public VectorAccessibleFacade(VectorContainer vc) { super("", null); this.vc = vc; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java index 66f658dc8..83e644e19 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedListReaderImpl.java @@ -43,16 +43,19 @@ public class RepeatedListReaderImpl extends AbstractFieldReader{ this.container = container; } + @Override public MajorType getType(){ return TYPE; } + @Override public void copyAsValue(ListWriter writer){ if(currentOffset == NO_VALUES) return; RepeatedListWriter impl = (RepeatedListWriter) writer; impl.inform(impl.container.copyFromSafe(idx(), impl.idx(), container)); } + @Override public void copyAsField(String name, MapWriter writer){ if(currentOffset == NO_VALUES) return; RepeatedListWriter impl = (RepeatedListWriter) writer.list(name); @@ -62,10 +65,12 @@ public class RepeatedListReaderImpl extends AbstractFieldReader{ private int currentOffset; private int maxOffset; + @Override public int size(){ return maxOffset - currentOffset; } + @Override public void setPosition(int index){ super.setPosition(index); RepeatedListHolder h = new RepeatedListHolder(); @@ -79,6 +84,7 @@ public class RepeatedListReaderImpl extends AbstractFieldReader{ } } + @Override public boolean next(){ if(currentOffset +1 < maxOffset){ currentOffset++; @@ -95,6 +101,7 @@ public class RepeatedListReaderImpl extends AbstractFieldReader{ return container.getAccessor().getObject(idx()); } + @Override public FieldReader reader(){ if(reader == null){ reader = container.get(name, ValueVector.class).getAccessor().getReader(); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java index b89d26d34..faf3508c1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/RepeatedMapReaderImpl.java @@ -49,6 +49,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ } } + @Override public FieldReader reader(String name){ FieldReader reader = fields.get(name); if(reader == null){ @@ -64,10 +65,11 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ return reader; } + @Override public FieldReader reader() { - if (currentOffset == NO_VALUES) + if (currentOffset == NO_VALUES) return NullReader.INSTANCE; - + setChildrenPosition(currentOffset); return new SingleLikeRepeatedMapReaderImpl(vector, this); } @@ -75,6 +77,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ private int currentOffset; private int maxOffset; + @Override public int size(){ if (isNull()) { return 0; @@ -82,6 +85,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ return maxOffset - (currentOffset < 0 ? 0 : currentOffset); } + @Override public void setPosition(int index){ super.setPosition(index); RepeatedMapHolder h = new RepeatedMapHolder(); @@ -110,6 +114,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ } } + @Override public boolean next(){ if(currentOffset +1 < maxOffset){ setChildrenPosition(++currentOffset); @@ -129,10 +134,12 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ return vector.getAccessor().getObject(idx()); } + @Override public MajorType getType(){ return vector.getField().getType(); } + @Override public java.util.Iterator<String> iterator(){ return vector.fieldNameIterator(); } @@ -142,6 +149,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ return true; } + @Override public void copyAsValue(MapWriter writer){ if(currentOffset == NO_VALUES) return; RepeatedMapWriter impl = (RepeatedMapWriter) writer; @@ -154,6 +162,7 @@ public class RepeatedMapReaderImpl extends AbstractFieldReader{ impl.inform(impl.container.copyFromSafe(currentOffset, impl.idx(), vector)); } + @Override public void copyAsField(String name, MapWriter writer){ if(currentOffset == NO_VALUES) return; RepeatedMapWriter impl = (RepeatedMapWriter) writer.map(name); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java index 36e04a7bb..872c5e32d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleListReaderImpl.java @@ -50,11 +50,13 @@ public class SingleListReaderImpl extends AbstractFieldReader{ this.container = container; } + @Override public MajorType getType(){ return TYPE; } + @Override public void setPosition(int index){ super.setPosition(index); if(reader != null) reader.setPosition(index); @@ -65,6 +67,7 @@ public class SingleListReaderImpl extends AbstractFieldReader{ return reader.readObject(); } + @Override public FieldReader reader(){ if(reader == null){ reader = container.get(name, ValueVector.class).getAccessor().getReader(); @@ -78,10 +81,12 @@ public class SingleListReaderImpl extends AbstractFieldReader{ return false; } + @Override public void copyAsValue(ListWriter writer){ throw new UnsupportedOperationException("Generic list copying not yet supported. Please resolve to typed list."); } + @Override public void copyAsField(String name, MapWriter writer){ throw new UnsupportedOperationException("Generic list copying not yet supported. Please resolve to typed list."); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java index 41450ce6c..c2d96b1e9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/SingleMapReaderImpl.java @@ -47,6 +47,7 @@ public class SingleMapReaderImpl extends AbstractFieldReader{ } } + @Override public FieldReader reader(String name){ FieldReader reader = fields.get(name); if(reader == null){ @@ -62,6 +63,7 @@ public class SingleMapReaderImpl extends AbstractFieldReader{ return reader; } + @Override public void setPosition(int index){ super.setPosition(index); for(FieldReader r : fields.values()){ @@ -79,19 +81,23 @@ public class SingleMapReaderImpl extends AbstractFieldReader{ return true; } + @Override public MajorType getType(){ return vector.getField().getType(); } + @Override public java.util.Iterator<String> iterator(){ return vector.fieldNameIterator(); } + @Override public void copyAsValue(MapWriter writer){ SingleMapWriter impl = (SingleMapWriter) writer; impl.inform(impl.container.copyFromSafe(idx(), impl.idx(), vector)); } + @Override public void copyAsField(String name, MapWriter writer){ SingleMapWriter impl = (SingleMapWriter) writer.map(name); impl.inform(impl.container.copyFromSafe(idx(), impl.idx(), vector)); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java index 57980f843..e92626e1b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/impl/VectorContainerWriter.java @@ -23,7 +23,6 @@ import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.complex.MapVector; -import org.apache.drill.exec.vector.complex.writer.BaseWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; public class VectorContainerWriter extends AbstractFieldWriter implements ComplexWriter { @@ -69,6 +68,7 @@ public class VectorContainerWriter extends AbstractFieldWriter implements Comple mapRoot.setValueCount(count); } + @Override public void setPosition(int index) { super.setPosition(index); mapRoot.setPosition(index); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/EndpointListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/EndpointListener.java index 6cec7b229..164f76e5e 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/EndpointListener.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/EndpointListener.java @@ -25,7 +25,7 @@ public abstract class EndpointListener<RET, V> extends BaseRpcOutcomeListener<RE protected final DrillbitEndpoint endpoint; protected final V value; - + public EndpointListener(DrillbitEndpoint endpoint, V value) { super(); this.endpoint = endpoint; @@ -40,5 +40,5 @@ public abstract class EndpointListener<RET, V> extends BaseRpcOutcomeListener<RE return value; } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/ErrorHelper.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/ErrorHelper.java index 7bb29197b..5679a4f82 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/ErrorHelper.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/ErrorHelper.java @@ -21,7 +21,6 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.UUID; -import org.apache.drill.common.exceptions.DrillException; import org.apache.drill.exec.planner.sql.parser.impl.ParseException; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.proto.UserBitShared.DrillPBError; @@ -73,7 +72,7 @@ public class ErrorHelper { String finalMsg = rootCause.getMessage() == null ? original.getMessage() : rootCause.getMessage(); builder.setMessage(String.format(sb.toString(), finalMsg)); builder.setErrorType(0); - + // record the error to the log for later reference. logger.error("Error {}: {}", id, message, t); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java index c3760d59a..9743d6e0c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/QueryWorkUnit.java @@ -26,17 +26,17 @@ import com.google.common.base.Preconditions; public class QueryWorkUnit { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryWorkUnit.class); - + private final PlanFragment rootFragment; // for local private final FragmentRoot rootOperator; // for local private final List<PlanFragment> fragments; - + public QueryWorkUnit(FragmentRoot rootOperator, PlanFragment rootFragment, List<PlanFragment> fragments) { super(); Preconditions.checkNotNull(rootFragment); Preconditions.checkNotNull(fragments); Preconditions.checkNotNull(rootOperator); - + this.rootFragment = rootFragment; this.fragments = fragments; this.rootOperator = rootOperator; @@ -53,11 +53,11 @@ public class QueryWorkUnit { public FragmentRoot getRootOperator() { return rootOperator; } - - - - - - - + + + + + + + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/ResourceRequest.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/ResourceRequest.java index 1e9ea5e40..5b7b623d9 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/ResourceRequest.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/ResourceRequest.java @@ -19,10 +19,10 @@ package org.apache.drill.exec.work; public class ResourceRequest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ResourceRequest.class); - + public long memoryMin; public long memoryDesired; - + public static class ResourceAllocation { public long memory; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/RootNodeDriver.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/RootNodeDriver.java index fee3d88d6..b56477bef 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/RootNodeDriver.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/RootNodeDriver.java @@ -19,7 +19,7 @@ package org.apache.drill.exec.work; public interface RootNodeDriver { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RootNodeDriver.class); - + public boolean doNext(); - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractDataCollector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractDataCollector.java index 6eafe574a..c83106c1f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractDataCollector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/AbstractDataCollector.java @@ -29,7 +29,6 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.Receiver; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.record.RawFragmentBatch; -import org.apache.drill.exec.rpc.ResponseSender; import com.google.common.base.Preconditions; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java index 893aec8b1..a7f36664b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/ControlHandlerImpl.java @@ -23,13 +23,8 @@ import io.netty.buffer.ByteBuf; import java.io.IOException; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.exception.FragmentSetupException; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; -import org.apache.drill.exec.memory.OutOfMemoryException; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.FragmentRoot; -import org.apache.drill.exec.physical.impl.ImplCreator; -import org.apache.drill.exec.physical.impl.RootExec; import org.apache.drill.exec.proto.BitControl.FinishedReceiver; import org.apache.drill.exec.proto.BitControl.FragmentStatus; import org.apache.drill.exec.proto.BitControl.PlanFragment; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/DataCollector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/DataCollector.java index 42d8eae8c..dc016beb0 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/DataCollector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/DataCollector.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.work.batch; import java.io.IOException; import org.apache.drill.exec.record.RawFragmentBatch; -import org.apache.drill.exec.rpc.ResponseSender; interface DataCollector extends AutoCloseable { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DataCollector.class); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java index af5e9c7de..1d6a70907 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/IncomingBuffers.java @@ -28,7 +28,6 @@ import org.apache.drill.exec.physical.base.AbstractPhysicalVisitor; import org.apache.drill.exec.physical.base.PhysicalOperator; import org.apache.drill.exec.physical.base.Receiver; import org.apache.drill.exec.record.RawFragmentBatch; -import org.apache.drill.exec.rpc.ResponseSender; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/MergingCollector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/MergingCollector.java index 5248bb1b3..ce142604b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/MergingCollector.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/MergingCollector.java @@ -25,7 +25,7 @@ import org.apache.drill.exec.physical.base.Receiver; public class MergingCollector extends AbstractDataCollector{ private AtomicInteger streamsRunning; - + public MergingCollector(AtomicInteger parentAccounter, Receiver receiver, FragmentContext context) { super(parentAccounter, receiver, 1, context); streamsRunning = new AtomicInteger(receiver.getProvidingEndpoints().size()); diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/RawBatchBuffer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/RawBatchBuffer.java index bc8a1dc8e..8646a72e4 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/RawBatchBuffer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/RawBatchBuffer.java @@ -21,7 +21,6 @@ import java.io.IOException; import org.apache.drill.exec.record.RawFragmentBatch; import org.apache.drill.exec.record.RawFragmentBatchProvider; -import org.apache.drill.exec.rpc.ResponseSender; /** * A batch buffer is responsible for queuing incoming batches until a consumer is ready to receive them. It will also diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/UnlimitedRawBatchBuffer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/UnlimitedRawBatchBuffer.java index 912f9560b..a4ed4d69c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/UnlimitedRawBatchBuffer.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/batch/UnlimitedRawBatchBuffer.java @@ -19,14 +19,11 @@ package org.apache.drill.exec.work.batch; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; import org.apache.drill.exec.ExecConstants; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.proto.BitData.FragmentRecordBatch; import org.apache.drill.exec.record.RawFragmentBatch; -import org.apache.drill.exec.rpc.ResponseSender; -import org.apache.drill.exec.rpc.data.DataRpcConfig; import com.google.common.collect.Queues; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java index 603aeab96..05fc2b1bc 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java @@ -23,7 +23,6 @@ import java.io.Closeable; import java.io.IOException; import java.util.LinkedList; import java.util.List; -import java.util.Queue; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -34,7 +33,6 @@ import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.common.logical.LogicalPlan; import org.apache.drill.common.logical.PlanProperties.Generator.ResultMode; import org.apache.drill.exec.ExecConstants; -import org.apache.drill.exec.cache.CachedVectorContainer; import org.apache.drill.exec.cache.DistributedCache.CacheConfig; import org.apache.drill.exec.cache.DistributedCache.SerializationMode; import org.apache.drill.exec.coord.DistributedSemaphore; @@ -70,7 +68,6 @@ import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.DrillbitContext; -import org.apache.drill.exec.server.options.OptionManager; import org.apache.drill.exec.util.AtomicState; import org.apache.drill.exec.util.Pointer; import org.apache.drill.exec.work.ErrorHelper; @@ -130,6 +127,7 @@ public class Foreman implements Runnable, Closeable, Comparable<Object>{ this.bee = bee; this.state = new AtomicState<QueryState>(QueryState.PENDING) { + @Override protected QueryState getStateFromNumber(int i) { return QueryState.valueOf(i); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/FragmentStatusListener.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/FragmentStatusListener.java index afc8d796e..6a719d2a1 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/FragmentStatusListener.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/FragmentStatusListener.java @@ -21,6 +21,6 @@ import org.apache.drill.exec.proto.BitControl.FragmentStatus; public interface FragmentStatusListener { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FragmentStatusListener.class); - + public void statusUpdate(FragmentStatus status); } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java index 4e1ca2236..083dd95ea 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.apache.drill.common.exceptions.ExecutionSetupException; -import org.apache.drill.exec.cache.DistributedCache; import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.base.FragmentRoot; import org.apache.drill.exec.proto.BitControl.FragmentStatus; @@ -39,7 +38,6 @@ import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState; import org.apache.drill.exec.proto.UserProtos.RunQuery; import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.RpcOutcomeListener; -import org.apache.drill.exec.rpc.control.ControlTunnel; import org.apache.drill.exec.rpc.control.Controller; import org.apache.drill.exec.rpc.control.WorkEventBus; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java index 62293fc93..f89cec929 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStatus.java @@ -17,12 +17,10 @@ */ package org.apache.drill.exec.work.foreman; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; + import org.apache.drill.common.exceptions.DrillRuntimeException; -import org.apache.drill.exec.cache.DistributedCache; -import org.apache.drill.exec.cache.DistributedCache.CacheConfig; -import org.apache.drill.exec.cache.DistributedCache.SerializationMode; -import org.apache.drill.exec.cache.DistributedMap; import org.apache.drill.exec.proto.BitControl.FragmentStatus; import org.apache.drill.exec.proto.SchemaUserBitShared; import org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile; @@ -31,17 +29,12 @@ import org.apache.drill.exec.proto.UserBitShared.QueryProfile; import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState; import org.apache.drill.exec.proto.UserProtos.RunQuery; import org.apache.drill.exec.proto.helper.QueryIdHelper; - -import com.carrotsearch.hppc.IntObjectOpenHashMap; import org.apache.drill.exec.store.sys.PStore; import org.apache.drill.exec.store.sys.PStoreConfig; import org.apache.drill.exec.store.sys.PStoreProvider; -import org.apache.drill.exec.work.foreman.Foreman.ForemanManagerListener; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import com.carrotsearch.hppc.IntObjectOpenHashMap; +import com.google.common.collect.Lists; public class QueryStatus { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(QueryStatus.class); @@ -133,6 +126,7 @@ public class QueryStatus { profileCache.put(queryId, getAsProfile(fullStatus)); } + @Override public String toString(){ return fragmentDataMap.toString(); } @@ -182,6 +176,7 @@ public class QueryStatus { return true; } + @Override public String toString(){ return major + ":" + minor; } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RootStatusReporter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RootStatusReporter.java index 6c7694a80..8c9829650 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RootStatusReporter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/RootStatusReporter.java @@ -25,7 +25,7 @@ import org.apache.drill.exec.work.fragment.AbstractStatusReporter; public class RootStatusReporter extends AbstractStatusReporter{ QueryManager runningFragmentManager; - + private RootStatusReporter(FragmentContext context){ super(context); } @@ -35,5 +35,5 @@ public class RootStatusReporter extends AbstractStatusReporter{ runningFragmentManager.statusUpdate(status); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentManager.java index 68849ff1c..2ff2ed489 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/FragmentManager.java @@ -22,7 +22,6 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.record.RawFragmentBatch; import org.apache.drill.exec.rpc.RemoteConnection; -import org.apache.drill.exec.rpc.ResponseSender; /** * The Fragment Manager is responsible managing incoming data and executing a fragment. Once enough data and resources diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootFragmentManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootFragmentManager.java index 48d14662e..02dec0af6 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootFragmentManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootFragmentManager.java @@ -23,18 +23,12 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.apache.drill.common.exceptions.ExecutionSetupException; import org.apache.drill.exec.exception.FragmentSetupException; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.base.FragmentLeaf; import org.apache.drill.exec.physical.base.FragmentRoot; -import org.apache.drill.exec.physical.impl.ImplCreator; -import org.apache.drill.exec.physical.impl.RootExec; -import org.apache.drill.exec.planner.PhysicalPlanReader; import org.apache.drill.exec.proto.BitControl.PlanFragment; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.record.RawFragmentBatch; import org.apache.drill.exec.rpc.RemoteConnection; -import org.apache.drill.exec.rpc.ResponseSender; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.work.WorkManager.WorkerBee; import org.apache.drill.exec.work.batch.IncomingBuffers; diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootStatusReporter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootStatusReporter.java index 353450039..71da12b7d 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootStatusReporter.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/NonRootStatusReporter.java @@ -23,22 +23,22 @@ import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.rpc.control.ControlTunnel; /** - * For all non root fragments, status will be reported back to the foreman through a control tunnel. + * For all non root fragments, status will be reported back to the foreman through a control tunnel. */ public class NonRootStatusReporter extends AbstractStatusReporter{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NonRootStatusReporter.class); - + private final ControlTunnel tunnel; public NonRootStatusReporter(FragmentContext context, ControlTunnel tunnel) { super(context); this.tunnel = tunnel; } - + @Override protected void statusChange(FragmentHandle handle, FragmentStatus status) { logger.debug("Sending status change message message to remote node: " + status); tunnel.sendFragmentStatus(status); } - + } diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/RootFragmentManager.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/RootFragmentManager.java index 4b9ee52ee..75dd923b3 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/RootFragmentManager.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/fragment/RootFragmentManager.java @@ -25,7 +25,6 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.record.RawFragmentBatch; import org.apache.drill.exec.rpc.RemoteConnection; -import org.apache.drill.exec.rpc.ResponseSender; import org.apache.drill.exec.work.batch.IncomingBuffers; public class RootFragmentManager implements FragmentManager{ diff --git a/exec/java-exec/src/main/java/parquet/hadoop/CodecFactoryExposer.java b/exec/java-exec/src/main/java/parquet/hadoop/CodecFactoryExposer.java index 7868a5324..d6584bb6d 100644 --- a/exec/java-exec/src/main/java/parquet/hadoop/CodecFactoryExposer.java +++ b/exec/java-exec/src/main/java/parquet/hadoop/CodecFactoryExposer.java @@ -17,6 +17,8 @@ */ package parquet.hadoop; +import io.netty.buffer.ByteBuf; + import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; @@ -25,15 +27,13 @@ import java.nio.channels.WritableByteChannel; import java.util.HashMap; import java.util.Map; -import io.netty.buffer.ByteBuf; import org.apache.drill.common.exceptions.DrillRuntimeException; import org.apache.hadoop.conf.Configuration; - import org.apache.hadoop.io.compress.CompressionCodec; import org.apache.hadoop.io.compress.DirectDecompressionCodec; import org.apache.hadoop.util.ReflectionUtils; + import parquet.bytes.BytesInput; -import parquet.hadoop.CodecFactory.BytesDecompressor; import parquet.hadoop.metadata.CompressionCodecName; public class CodecFactoryExposer{ @@ -115,6 +115,7 @@ public class CodecFactoryExposer{ this.length = length; } + @Override public void writeAllTo(OutputStream out) throws IOException { final WritableByteChannel outputChannel = Channels.newChannel(out); byteBuf.position(offset); @@ -123,6 +124,7 @@ public class CodecFactoryExposer{ outputChannel.write(tempBuf); } + @Override public ByteBuffer toByteBuffer() throws IOException { byteBuf.position(offset); ByteBuffer buf = byteBuf.slice(); @@ -130,6 +132,7 @@ public class CodecFactoryExposer{ return buf; } + @Override public long size() { return length; } diff --git a/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkIncReadStore.java b/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkIncReadStore.java index 50107ac47..2a3124c9c 100644 --- a/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkIncReadStore.java +++ b/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkIncReadStore.java @@ -18,12 +18,20 @@ package parquet.hadoop; import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.drill.exec.memory.BufferAllocator; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.io.compress.Decompressor; + import parquet.bytes.BytesInput; import parquet.column.ColumnDescriptor; import parquet.column.page.DictionaryPage; @@ -31,21 +39,12 @@ import parquet.column.page.Page; import parquet.column.page.PageReadStore; import parquet.column.page.PageReader; import parquet.format.PageHeader; -import parquet.format.PageType; import parquet.format.Util; import parquet.format.converter.ParquetMetadataConverter; import parquet.hadoop.CodecFactory.BytesDecompressor; import parquet.hadoop.metadata.ColumnChunkMetaData; -import parquet.hadoop.metadata.FileMetaData; import parquet.hadoop.util.CompatibilityUtil; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ColumnChunkIncReadStore implements PageReadStore { diff --git a/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkPageWriteStoreExposer.java b/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkPageWriteStoreExposer.java index 0ffc3ba92..0e9dec0f1 100644 --- a/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkPageWriteStoreExposer.java +++ b/exec/java-exec/src/main/java/parquet/hadoop/ColumnChunkPageWriteStoreExposer.java @@ -17,16 +17,17 @@ */ package parquet.hadoop; +import java.io.IOException; + import org.apache.drill.exec.ops.OperatorContext; import org.apache.drill.exec.store.parquet.ParquetDirectByteBufferAllocator; import org.apache.hadoop.conf.Configuration; + import parquet.column.page.PageWriteStore; import parquet.hadoop.CodecFactory.BytesCompressor; import parquet.hadoop.metadata.CompressionCodecName; import parquet.schema.MessageType; -import java.io.IOException; - public class ColumnChunkPageWriteStoreExposer { public static ColumnChunkPageWriteStore newColumnChunkPageWriteStore(OperatorContext oContext, diff --git a/exec/java-exec/src/test/java/org/apache/drill/ParquetSchemaMerge.java b/exec/java-exec/src/test/java/org/apache/drill/ParquetSchemaMerge.java index af38d0878..f9cfdb5b6 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/ParquetSchemaMerge.java +++ b/exec/java-exec/src/test/java/org/apache/drill/ParquetSchemaMerge.java @@ -21,7 +21,6 @@ import parquet.schema.GroupType; import parquet.schema.MessageType; import parquet.schema.PrimitiveType; import parquet.schema.PrimitiveType.PrimitiveTypeName; -import parquet.schema.Type; import parquet.schema.Type.Repetition; public class ParquetSchemaMerge { diff --git a/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java b/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java index f01a70661..aca7d06c6 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java +++ b/exec/java-exec/src/test/java/org/apache/drill/PlanningBase.java @@ -17,15 +17,14 @@ */ package org.apache.drill; -import com.codahale.metrics.MetricRegistry; -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableList; -import com.google.common.io.Resources; +import java.io.IOException; +import java.net.URL; + import mockit.Mocked; import mockit.NonStrictExpectations; import net.hydromatic.optiq.SchemaPlus; import net.hydromatic.optiq.jdbc.SimpleOptiqSchema; -import net.hydromatic.optiq.tools.Frameworks; + import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.util.TestTools; import org.apache.drill.exec.ExecTest; @@ -49,8 +48,10 @@ import org.apache.drill.exec.store.sys.local.LocalPStoreProvider; import org.junit.Rule; import org.junit.rules.TestRule; -import java.io.IOException; -import java.net.URL; +import com.codahale.metrics.MetricRegistry; +import com.google.common.base.Charsets; +import com.google.common.collect.ImmutableList; +import com.google.common.io.Resources; public class PlanningBase extends ExecTest{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PlanningBase.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java index de1b49a25..57689080e 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestAltSortQueries.java @@ -17,12 +17,7 @@ */ package org.apache.drill; -import org.apache.drill.common.util.TestTools; -import org.apache.drill.exec.client.QuerySubmitter; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; -import org.junit.Ignore; public class TestAltSortQueries extends BaseTestQuery{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestAltSortQueries.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java index 58a18137b..c54772f11 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java @@ -19,7 +19,6 @@ package org.apache.drill; import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.rpc.RpcException; -import org.junit.Ignore; import org.junit.Test; public class TestExampleQueries extends BaseTestQuery{ @@ -31,7 +30,7 @@ public class TestExampleQueries extends BaseTestQuery{ test("select * from cp.`parquet/complex.parquet`"); test("select recipe, c.inventor.name as name, c.inventor.age as age from cp.`parquet/complex.parquet` c"); } - + @Test // see DRILL-553 public void testQueryWithNullValues() throws Exception { test("select count(*) from cp.`customer.json` limit 1"); @@ -111,8 +110,8 @@ public class TestExampleQueries extends BaseTestQuery{ } @Test // DRILL-1293 - public void testStarView1() throws Exception { - test("use dfs.tmp"); + public void testStarView1() throws Exception { + test("use dfs.tmp"); test("create view vt1 as select * from cp.`tpch/region.parquet` r, cp.`tpch/nation.parquet` n where r.r_regionkey = n.n_regionkey"); test("select * from vt1"); test("drop view vt1"); @@ -313,7 +312,7 @@ public class TestExampleQueries extends BaseTestQuery{ test("select n.n_nationkey from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey limit 0"); test("select n_regionkey, count(*) from cp.`tpch/nation.parquet` group by n_regionkey limit 0"); } - + @Test public void testTextJoin() throws Exception { String root = FileUtils.getResourceAsFile("/store/text/data/nations.csv").toURI().toString(); diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestProjectPushDown.java b/exec/java-exec/src/test/java/org/apache/drill/TestProjectPushDown.java index 8520b9bf9..e45b24832 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestProjectPushDown.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestProjectPushDown.java @@ -18,8 +18,6 @@ package org.apache.drill; -import java.util.List; - import org.junit.Ignore; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java b/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java index adf5778da..254d9be88 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java @@ -132,7 +132,7 @@ public class TestTpchDistributed extends BaseTestQuery{ public void tpch19_1() throws Exception{ testDistributed("queries/tpch/19_1.sql"); } - + @Test public void tpch20() throws Exception{ testDistributed("queries/tpch/20.sql"); 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 c21298e02..bf0eea0c9 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 @@ -17,46 +17,45 @@ */ package org.apache.drill; -import org.junit.Ignore; import org.junit.Test; public class TestUnionAll extends BaseTestQuery{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestUnionAll.class); - + @Test // Simple Union-All over two scans public void testUnionAll1() throws Exception { - test("select n_regionkey from cp.`tpch/nation.parquet` union all select r_regionkey from cp.`tpch/region.parquet`"); + test("select n_regionkey from cp.`tpch/nation.parquet` union all select r_regionkey from cp.`tpch/region.parquet`"); } @Test // Union-All over inner joins public void testUnionAll2() throws Exception { test("select n1.n_nationkey from cp.`tpch/nation.parquet` n1 inner join cp.`tpch/region.parquet` r1 on n1.n_regionkey = r1.r_regionkey where n1.n_nationkey in (1, 2) union all select n2.n_nationkey from cp.`tpch/nation.parquet` n2 inner join cp.`tpch/region.parquet` r2 on n2.n_regionkey = r2.r_regionkey where n2.n_nationkey in (3, 4)"); } - + @Test // Union-All over grouped aggregates public void testUnionAll3() throws Exception { test("select n1.n_nationkey from cp.`tpch/nation.parquet` n1 where n1.n_nationkey in (1, 2) group by n1.n_nationkey union all select r1.r_regionkey from cp.`tpch/region.parquet` r1 group by r1.r_regionkey"); } - + @Test // Chain of Union-Alls public void testUnionAll4() throws Exception { - test("select n_regionkey from cp.`tpch/nation.parquet` union all select r_regionkey from cp.`tpch/region.parquet` union all select n_nationkey from cp.`tpch/nation.parquet` union all select c_custkey from cp.`tpch/customer.parquet` where c_custkey < 5"); + test("select n_regionkey from cp.`tpch/nation.parquet` union all select r_regionkey from cp.`tpch/region.parquet` union all select n_nationkey from cp.`tpch/nation.parquet` union all select c_custkey from cp.`tpch/customer.parquet` where c_custkey < 5"); } - + @Test // Union-All of all columns in the table public void testUnionAll5() throws Exception { test("select * from cp.`tpch/region.parquet` r1 union all select * from cp.`tpch/region.parquet` r2"); } - + @Test // Union-All where same column is projected twice in right child public void testUnionAll6() throws Exception { test("select n_nationkey, n_regionkey from cp.`tpch/nation.parquet` where n_regionkey = 1 union all select r_regionkey, r_regionkey from cp.`tpch/region.parquet` where r_regionkey = 2"); - } - + } + @Test // Union-All where same column is projected twice in left and right child public void testUnionAll6_1() throws Exception { test("select n_nationkey, n_nationkey from cp.`tpch/nation.parquet` union all select r_regionkey, r_regionkey from cp.`tpch/region.parquet`"); - } + } @Test // Union-all of two string literals of different lengths public void testUnionAll7() throws Exception { @@ -65,8 +64,8 @@ public class TestUnionAll extends BaseTestQuery{ @Test // Union-all of two character columns of different lengths public void testUnionAll8() throws Exception { - test("select n_name from cp.`tpch/nation.parquet` union all select r_comment from cp.`tpch/region.parquet`"); + test("select n_name from cp.`tpch/nation.parquet` union all select r_comment from cp.`tpch/region.parquet`"); } - - + + } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java index dee865ed0..75ba3a9d6 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java @@ -19,15 +19,11 @@ package org.apache.drill.exec; import static com.google.common.base.Throwables.propagate; -import java.io.File; -import java.io.IOException; import java.util.List; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.exception.DrillbitStartupException; import org.apache.drill.exec.server.Drillbit; -import org.apache.drill.exec.util.MiniZooKeeperCluster; -import org.junit.BeforeClass; import org.slf4j.Logger; import com.google.common.collect.ImmutableList; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/SortTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/SortTest.java index 7cdf969bd..0a3ad74e1 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/SortTest.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/SortTest.java @@ -27,10 +27,10 @@ public class SortTest { private static final int RECORD_COUNT = 10*1000*1000; private static final int KEY_SIZE = 10; private static final int DATA_SIZE = 90; - private static final int RECORD_SIZE = KEY_SIZE + DATA_SIZE; - + private static final int RECORD_SIZE = KEY_SIZE + DATA_SIZE; + private byte[] data; - + public static void main(String[] args) throws Exception{ for(int i =0; i < 100; i++){ SortTest st = new SortTest(); @@ -40,7 +40,7 @@ public class SortTest { System.out.println(" ns."); } } - + SortTest(){ System.out.print("Generating data... "); data = new byte[RECORD_SIZE*RECORD_COUNT]; @@ -48,7 +48,7 @@ public class SortTest { r.nextBytes(data); System.out.print("Data generated. "); } - + public long doSort(){ QuickSort qs = new QuickSort(); ByteSortable b = new ByteSortable(); @@ -56,11 +56,11 @@ public class SortTest { qs.sort(b, 0, RECORD_COUNT); return System.nanoTime() - nano; } - + private class ByteSortable implements IndexedSortable{ final byte[] space = new byte[RECORD_SIZE]; final BytesWritable.Comparator comparator = new BytesWritable.Comparator(); - + @Override public int compare(int index1, int index2) { return comparator.compare(data, index1*RECORD_SIZE, KEY_SIZE, data, index2*RECORD_SIZE, KEY_SIZE); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java index ec6c251dd..67b102d5b 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestQueriesOnLargeFile.java @@ -18,10 +18,14 @@ package org.apache.drill.exec; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import org.apache.drill.common.util.FileUtils; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.PrintWriter; +import java.util.List; + import org.apache.drill.BaseTestQuery; +import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.vector.BigIntVector; @@ -29,11 +33,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import java.io.File; -import java.io.PrintWriter; -import java.util.List; - -import static org.junit.Assert.assertTrue; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestQueriesOnLargeFile extends BaseTestQuery { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestQueriesOnLargeFile.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestCacheSerialization.java b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestCacheSerialization.java index d548f6a49..d50791373 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestCacheSerialization.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestCacheSerialization.java @@ -20,7 +20,6 @@ package org.apache.drill.exec.cache; 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.types.TypeProtos; import org.apache.drill.common.types.Types; @@ -38,7 +37,6 @@ import org.apache.drill.exec.record.VectorAccessible; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.WritableBatch; -import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.server.options.OptionValue; import org.apache.drill.exec.server.options.OptionValue.OptionType; import org.apache.drill.exec.vector.AllocationHelper; @@ -51,7 +49,6 @@ import org.junit.BeforeClass; import org.junit.Test; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; public class TestCacheSerialization extends ExecTest { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java index e678c294a..f4f4966f5 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/client/DumpCatTest.java @@ -26,8 +26,8 @@ import mockit.NonStrictExpectations; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.util.FileUtils; -import org.apache.drill.exec.ExecTest; import org.apache.drill.exec.ExecConstants; +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.TopLevelAllocator; @@ -47,7 +47,6 @@ import org.apache.drill.exec.server.DrillbitContext; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; -import org.junit.AfterClass; import org.junit.Test; import com.codahale.metrics.MetricRegistry; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplate.java b/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplate.java index 001190568..4fc5b3a17 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplate.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplate.java @@ -24,7 +24,7 @@ public abstract class ExampleTemplate implements ExampleExternalInterface{ public final String getData() { return this.getInternalData(); } - + abstract String getInternalData(); - + } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplateWithInner.java b/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplateWithInner.java index 418d71423..f80ca367f 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplateWithInner.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/compile/ExampleTemplateWithInner.java @@ -21,30 +21,30 @@ import org.apache.drill.exec.compile.sig.RuntimeOverridden; public abstract class ExampleTemplateWithInner implements ExampleInner{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExampleTemplateWithInner.class); - + public abstract void doOutside(); public class TheInnerClass{ - + @RuntimeOverridden public void doInside(){}; - - + + public void doDouble(){ DoubleInner di = new DoubleInner(); di.doDouble(); } - + public class DoubleInner{ @RuntimeOverridden public void doDouble(){}; } - + } - + public void doInsideOutside(){ TheInnerClass inner = new TheInnerClass(); inner.doInside(); inner.doDouble(); } - + } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java index 392af182c..2311cfd83 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/expr/ExpressionTest.java @@ -46,7 +46,6 @@ import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.vector.IntVector; import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; import org.junit.Test; public class ExpressionTest extends ExecTest { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestByteComparisonFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestByteComparisonFunctions.java index 632f5a4ba..5ec162d70 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestByteComparisonFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestByteComparisonFunctions.java @@ -17,7 +17,7 @@ */ package org.apache.drill.exec.fn.impl; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecTest; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java index 8e6813c27..9b8070bb0 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestMultiInputAdd.java @@ -18,18 +18,16 @@ package org.apache.drill.exec.fn.impl; -import com.codahale.metrics.MetricRegistry; -import com.google.common.base.Charsets; -import com.google.common.io.Files; +import static org.junit.Assert.assertTrue; + +import java.util.List; + import mockit.Injectable; -import mockit.NonStrictExpectations; + 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.pop.PopUnitTestBase; -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; @@ -37,14 +35,11 @@ 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.IntVector; -import org.apache.drill.exec.vector.Float8Vector; import org.apache.drill.exec.vector.ValueVector; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertTrue; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestMultiInputAdd extends PopUnitTestBase { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java index 3d41f0b95..28e667e3d 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewMathFunctions.java @@ -37,8 +37,8 @@ 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.BitControl.PlanFragment; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.ValueVector; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java index fd71dd983..73c750833 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestRepeatedFunction.java @@ -43,7 +43,6 @@ import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.BitVector; import org.apache.drill.exec.vector.IntVector; -import org.junit.AfterClass; import org.junit.Test; import com.codahale.metrics.MetricRegistry; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestEndianess.java b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestEndianess.java index d94b53aec..48ddada9b 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestEndianess.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/memory/TestEndianess.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import org.apache.drill.exec.ExecTest; -import org.apache.drill.exec.memory.TopLevelAllocator; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java index db8ff8e22..a15b50386 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/SimpleRootExec.java @@ -25,7 +25,6 @@ import org.apache.drill.exec.ops.FragmentContext; import org.apache.drill.exec.physical.impl.ScreenCreator.ScreenRoot; import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.record.RecordBatch; -import org.apache.drill.exec.record.RecordBatch.IterOutcome; import org.apache.drill.exec.record.TypedFieldId; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.record.selection.SelectionVector2; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java index 457e0b1c8..0d9f0149c 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java @@ -48,7 +48,6 @@ import org.apache.drill.exec.planner.PhysicalPlanReader; 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.VectorAccessible; import org.apache.drill.exec.record.VectorWrapper; @@ -63,7 +62,6 @@ import org.apache.drill.exec.vector.Float8Vector; import org.apache.drill.exec.vector.IntVector; import org.apache.drill.exec.vector.VarBinaryVector; import org.apache.drill.exec.vector.VarCharVector; -import org.junit.After; import org.junit.Test; import com.codahale.metrics.MetricRegistry; 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 c0fd23ac8..dcc2fde40 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 @@ -25,13 +25,11 @@ 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.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.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; -import org.apache.drill.exec.vector.NullableBigIntVector; import org.apache.drill.exec.vector.ValueVector; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestComparisonFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestComparisonFunctions.java index da018c372..421c3f59f 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestComparisonFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestComparisonFunctions.java @@ -17,10 +17,8 @@ */ package org.apache.drill.exec.physical.impl; -import com.google.common.base.Charsets; -import com.google.common.io.Resources; -import com.codahale.metrics.MetricRegistry; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import mockit.Injectable; import mockit.NonStrictExpectations; @@ -28,23 +26,20 @@ import org.apache.drill.common.config.DrillConfig; 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.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.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.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; -import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.codahale.metrics.MetricRegistry; +import com.google.common.base.Charsets; +import com.google.common.io.Resources; public class TestComparisonFunctions extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestComparisonFunctions.class); 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 489336a0b..780e20e71 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 @@ -27,14 +27,12 @@ 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.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.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.vector.ValueVector; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java index f769f1e18..e3fca8576 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestHashToRandomExchange.java @@ -24,11 +24,9 @@ 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.UserProtos; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java index 2ff99c83e..13c9364cf 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestImplicitCastFunctions.java @@ -36,7 +36,6 @@ import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; import org.junit.Test; import com.codahale.metrics.MetricRegistry; 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 93a387f84..a62409bcc 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 @@ -28,11 +28,9 @@ import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.ExecTest; import org.apache.drill.exec.cache.DistributedCache; import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.compile.CodeCompiler; import org.apache.drill.exec.coord.ClusterCoordinator; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.apache.drill.exec.expr.holders.VarBinaryHolder; -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.ops.QueryContext; @@ -40,12 +38,10 @@ import org.apache.drill.exec.opt.BasicOptimizer; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.physical.base.FragmentRoot; import org.apache.drill.exec.planner.PhysicalPlanReader; -import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.proto.BitControl.PlanFragment; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; import org.apache.drill.exec.proto.UserBitShared.QueryId; -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.control.Controller; @@ -62,7 +58,6 @@ import org.apache.drill.exec.store.StoragePluginRegistry; import org.apache.drill.exec.store.sys.local.LocalPStoreProvider; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.VarBinaryVector; -import org.junit.AfterClass; import org.junit.Ignore; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java index c8209ace9..2880b18c5 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestReverseImplicitCast.java @@ -17,13 +17,17 @@ */ package org.apache.drill.exec.physical.impl; -import com.google.common.base.Charsets; -import com.google.common.io.Files; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Iterator; +import java.util.List; + import mockit.Injectable; + 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.UserProtos; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.record.VectorWrapper; import org.apache.drill.exec.rpc.user.QueryResultBatch; @@ -34,11 +38,8 @@ import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.vector.ValueVector; import org.junit.Test; -import java.util.Iterator; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestReverseImplicitCast extends PopUnitTestBase { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java index 2e60893b8..a48510fa1 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java @@ -24,7 +24,6 @@ import mockit.NonStrictExpectations; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecTest; -import org.apache.drill.exec.cache.local.LocalCache; import org.apache.drill.exec.compile.CodeCompiler; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.apache.drill.exec.memory.TopLevelAllocator; @@ -36,8 +35,6 @@ import org.apache.drill.exec.proto.BitControl.PlanFragment; import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; -import org.apache.drill.exec.server.options.SystemOptionManager; -import org.apache.drill.exec.store.sys.local.LocalPStoreProvider; import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.VarCharVector; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java index 6240e8117..4ad215d9a 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestUnionExchange.java @@ -17,20 +17,20 @@ */ package org.apache.drill.exec.physical.impl; -import com.google.common.base.Charsets; -import com.google.common.io.Files; +import static org.junit.Assert.assertEquals; + +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.UserProtos; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertEquals; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestUnionExchange extends PopUnitTestBase { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java index eb290e9b1..430c5056b 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TopN/TestSimpleTopN.java @@ -17,44 +17,26 @@ */ package org.apache.drill.exec.physical.impl.TopN; -import com.codahale.metrics.MetricRegistry; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import mockit.Injectable; -import mockit.NonStrictExpectations; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +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.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.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.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.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.IntVector; -import org.junit.AfterClass; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestSimpleTopN extends PopUnitTestBase { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleTopN.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java index 9047208b8..3786bfdeb 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/agg/TestHashAggr.java @@ -29,28 +29,28 @@ public class TestHashAggr extends BaseTestQuery{ public void testQ6() throws Exception{ testPhysicalFromFile("agg/hashagg/q6.json"); } - + @Test public void testQ7_1() throws Exception{ testPhysicalFromFile("agg/hashagg/q7_1.json"); } - + @Test public void testQ7_2() throws Exception{ testPhysicalFromFile("agg/hashagg/q7_2.json"); } - + @Test public void testQ7_3() throws Exception{ testPhysicalFromFile("agg/hashagg/q7_3.json"); - } - + } + @Ignore // ignore temporarily since this shows memory leak in ParquetRecordReader (DRILL-443) @Test public void testQ8_1() throws Exception{ testPhysicalFromFile("agg/hashagg/q8_1.json"); } - + @Ignore // ignore temporarily since this shows memory leak in ParquetRecordReader (DRILL-443) @Test public void test8() throws Exception{ 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 ed5068554..1f0d89e35 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 @@ -29,8 +29,6 @@ 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.cache.DistributedCache; -import org.apache.drill.exec.cache.local.LocalCache; import org.apache.drill.exec.client.DrillClient; import org.apache.drill.exec.compile.CodeCompiler; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; @@ -52,8 +50,6 @@ 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.server.options.OptionManager; -import org.apache.drill.exec.server.options.SessionOptionManager; import org.apache.drill.exec.server.options.SystemOptionManager; import org.apache.drill.exec.store.sys.local.LocalPStoreProvider; import org.apache.drill.exec.vector.ValueVector; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java index 7b264c4e0..86584bb2e 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java @@ -31,20 +31,17 @@ import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.client.DrillClient; import org.apache.drill.exec.compile.CodeCompiler; 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.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.proto.ExecProtos; -import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.proto.BitControl.PlanFragment; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; @@ -53,14 +50,13 @@ import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.store.StoragePluginRegistry; import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; import org.junit.Ignore; import org.junit.Test; -import com.google.common.collect.Lists; +import com.codahale.metrics.MetricRegistry; import com.google.common.base.Charsets; +import com.google.common.collect.Lists; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; public class TestMergeJoin extends PopUnitTestBase { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java index bf402d127..a3a7aced8 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinMulCondition.java @@ -25,11 +25,9 @@ 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.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestRule; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java index 87ee25939..3ba6cb175 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/limit/TestSimpleLimit.java @@ -17,11 +17,8 @@ */ package org.apache.drill.exec.physical.impl.limit; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; - -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import mockit.Injectable; import mockit.NonStrictExpectations; @@ -30,28 +27,25 @@ import org.apache.drill.common.util.FileUtils; 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.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.record.VectorWrapper; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.BigIntVector; -import org.apache.drill.exec.vector.ValueVector; import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.codahale.metrics.MetricRegistry; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestSimpleLimit extends ExecTest { DrillConfig c = DrillConfig.create(); 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 3fb04aa7e..e8553ca5c 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 @@ -18,27 +18,25 @@ package org.apache.drill.exec.physical.impl.mergereceiver; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; -import com.google.common.collect.Lists; 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.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.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; +import com.google.common.collect.Lists; import com.google.common.io.Files; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class TestMergingReceiver extends PopUnitTestBase { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestMergingReceiver.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java index c29d99ee2..8419860e0 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/orderedpartitioner/TestOrderedPartitionExchange.java @@ -29,7 +29,6 @@ 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.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.server.BootStrapContext; 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 514e913e0..28d2897e6 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 @@ -29,30 +29,25 @@ import org.apache.drill.common.util.FileUtils; 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.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.BitControl.PlanFragment; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.util.VectorUtil; -import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.NullableBigIntVector; -import org.junit.After; -import org.junit.AfterClass; import org.junit.Test; +import com.codahale.metrics.MetricRegistry; import com.google.common.base.Charsets; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; public class TestSimpleProjection extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleProjection.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java index 4f8ba7e39..d27ad79d0 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/sort/TestSimpleSort.java @@ -28,28 +28,25 @@ import org.apache.drill.common.util.FileUtils; 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.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.BitControl.PlanFragment; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.IntVector; -import org.junit.AfterClass; import org.junit.Test; +import com.codahale.metrics.MetricRegistry; import com.google.common.base.Charsets; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; public class TestSimpleSort extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleSort.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/svremover/TestSVRemover.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/svremover/TestSVRemover.java index bb7ec6938..05161ca06 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/svremover/TestSVRemover.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/svremover/TestSVRemover.java @@ -27,28 +27,24 @@ import org.apache.drill.common.util.FileUtils; 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.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.BitControl.PlanFragment; -import org.apache.drill.exec.proto.ExecProtos.FragmentHandle; +import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.vector.ValueVector; -import org.junit.After; -import org.junit.AfterClass; import org.junit.Test; +import com.codahale.metrics.MetricRegistry; import com.google.common.base.Charsets; import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; public class TestSVRemover extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSVRemover.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java index 3420169d5..07de27f39 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/union/TestSimpleUnion.java @@ -17,10 +17,8 @@ */ package org.apache.drill.exec.physical.impl.union; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.codahale.metrics.MetricRegistry; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import mockit.Injectable; import mockit.NonStrictExpectations; @@ -29,25 +27,23 @@ import org.apache.drill.common.util.FileUtils; 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.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.proto.CoordinationProtos; import org.apache.drill.exec.rpc.user.UserServer; import org.apache.drill.exec.server.DrillbitContext; -import org.junit.After; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.codahale.metrics.MetricRegistry; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestSimpleUnion extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSimpleUnion.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java index 210267423..af4afa48c 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java @@ -17,6 +17,8 @@ */ package org.apache.drill.exec.physical.impl.writer; +import static org.junit.Assert.assertEquals; + import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; import java.util.ArrayList; @@ -46,8 +48,6 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class TestParquetWriter extends BaseTestQuery { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestParquetWriter.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java index 1dc819262..c8790a8d1 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestWriter.java @@ -34,7 +34,6 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import com.google.common.base.Charsets; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java index 9a1eb941d..ce4757895 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/PopUnitTestBase.java @@ -21,7 +21,6 @@ import java.io.IOException; 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.ExecTest; import org.apache.drill.exec.exception.FragmentSetupException; import org.apache.drill.exec.physical.PhysicalPlan; @@ -31,10 +30,6 @@ import org.apache.drill.exec.planner.fragment.Fragment; import org.apache.drill.exec.planner.fragment.Fragment.ExchangeFragmentPair; import org.apache.drill.exec.planner.fragment.MakeFragmentsVisitor; import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.junit.rules.TestRule; -import org.junit.rules.Timeout; import com.google.common.base.Charsets; import com.google.common.io.Files; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java index d72e47f28..ec8bd9429 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/pop/TestFragmenter.java @@ -63,9 +63,9 @@ public class TestFragmenter extends PopUnitTestBase { - - - + + + } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/CachedSingleFileSystem.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/CachedSingleFileSystem.java index 46a278583..6d6baf4e1 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/CachedSingleFileSystem.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/CachedSingleFileSystem.java @@ -42,7 +42,7 @@ public class CachedSingleFileSystem extends FileSystem{ private ByteBuf file; private String path; - + public CachedSingleFileSystem(String path) throws IOException{ this.path = path; File f = new File(path); @@ -59,11 +59,12 @@ public class CachedSingleFileSystem extends FileSystem{ } } + @Override public void close() throws IOException{ file.release(); super.close(); } - + @Override public FSDataOutputStream append(Path arg0, int arg1, Progressable arg2) throws IOException { throw new UnsupportedOperationException(); @@ -125,14 +126,14 @@ public class CachedSingleFileSystem extends FileSystem{ public void setWorkingDirectory(Path arg0) { throw new UnsupportedOperationException(); } - - + + private class CachedFSDataInputStream extends ByteBufInputStream implements Seekable, PositionedReadable{ private ByteBuf buf; public CachedFSDataInputStream(ByteBuf buffer) { super(buffer); this.buf = buffer; - + } @Override diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestAffinityCalculator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestAffinityCalculator.java index 58a36a87e..0999218dc 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestAffinityCalculator.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestAffinityCalculator.java @@ -17,35 +17,16 @@ */ package org.apache.drill.exec.store; -import com.google.common.collect.ImmutableRangeMap; -import com.google.common.collect.Range; - -import junit.framework.Assert; -import mockit.Injectable; -import mockit.NonStrictExpectations; +import java.util.LinkedList; import org.apache.drill.exec.ExecTest; -import org.apache.drill.exec.physical.EndpointAffinity; import org.apache.drill.exec.proto.CoordinationProtos; -import org.apache.drill.exec.server.DrillbitContext; import org.apache.drill.exec.store.parquet.ParquetGroupScan; -import org.apache.drill.exec.store.parquet.ParquetRowGroupScan; -import org.apache.drill.exec.store.parquet.ParquetFormatPlugin; -import org.apache.drill.exec.store.schedule.BlockMapBuilder; import org.apache.hadoop.fs.BlockLocation; -import org.apache.hadoop.fs.FileStatus; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; -import org.junit.Before; import org.junit.Test; -import static junit.framework.Assert.assertNull; -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; +import com.google.common.collect.ImmutableRangeMap; +import com.google.common.collect.Range; public class TestAffinityCalculator extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestAffinityCalculator.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOutputMutator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOutputMutator.java index b5e856444..b40edd119 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOutputMutator.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOutputMutator.java @@ -27,7 +27,6 @@ import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.TypeHelper; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.physical.impl.OutputMutator; -import org.apache.drill.exec.record.BatchSchema.SelectionVectorMode; import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.VectorContainer; import org.apache.drill.exec.record.VectorWrapper; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java index 34bcb5ead..c83a3aba1 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/json/JsonRecordReader2Test.java @@ -18,7 +18,6 @@ package org.apache.drill.exec.store.json; import org.apache.drill.BaseTestQuery; -import org.junit.Ignore; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java index c49c328bd..b2c859662 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetRecordReaderTest.java @@ -38,7 +38,6 @@ import org.apache.drill.common.expression.ExpressionPosition; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.common.util.FileUtils; -import org.apache.drill.common.util.TestTools; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; import org.apache.drill.exec.memory.BufferAllocator; @@ -58,7 +57,6 @@ import org.apache.drill.exec.store.TestOutputMutator; import org.apache.drill.exec.store.parquet.columnreaders.ParquetRecordReader; import org.apache.drill.exec.vector.BigIntVector; import org.apache.drill.exec.vector.NullableBigIntVector; -import org.apache.drill.exec.vector.NullableIntVector; import org.apache.drill.exec.vector.ValueVector; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -66,10 +64,8 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; import org.junit.BeforeClass; import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; import parquet.bytes.BytesInput; import parquet.column.page.Page; import parquet.column.page.PageReadStore; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java index dd198f51e..52d508649 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java @@ -33,7 +33,6 @@ import org.apache.drill.exec.rpc.RpcException; import org.apache.drill.exec.rpc.user.ConnectionThrottle; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.rpc.user.UserResultsListener; -import org.apache.drill.exec.vector.BaseDataValueVector; import org.apache.drill.exec.vector.ValueVector; import com.google.common.base.Strings; @@ -151,7 +150,7 @@ public class ParquetResultListener implements UserResultsListener { if(result.getHeader().getIsLastChunk()){ checkLastChunk(batchLoader, result); } - + batchLoader.clear(); result.release(); } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestFileGenerator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestFileGenerator.java index fb1ea60e7..0dfb1d8ee 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestFileGenerator.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestFileGenerator.java @@ -127,6 +127,7 @@ public class TestFileGenerator { position.reset(); } + @Override public Object getValue() { Object ret = values[position.val]; position.increment(); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java index 797c63cbc..84913125b 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java @@ -26,7 +26,6 @@ import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.ExecTest; import org.apache.drill.exec.client.DrillClient; import org.apache.drill.exec.proto.UserBitShared.QueryId; -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.RpcException; @@ -36,7 +35,6 @@ import org.apache.drill.exec.rpc.user.UserResultsListener; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; import org.apache.drill.exec.vector.ValueVector; -import org.junit.AfterClass; import org.junit.Ignore; import org.junit.Test; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java index e16f78176..e5a2c94a9 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TestTextColumn.java @@ -17,6 +17,12 @@ */ package org.apache.drill.exec.store.text; +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import org.apache.drill.BaseTestQuery; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.record.RecordBatchLoader; @@ -25,12 +31,6 @@ import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.vector.ValueVector; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; - public class TestTextColumn extends BaseTestQuery{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestTextColumn.class); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java index 309191497..fa43d5574 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/text/TextRecordReaderTest.java @@ -17,45 +17,22 @@ */ package org.apache.drill.exec.store.text; -import com.codahale.metrics.MetricRegistry; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import mockit.Injectable; -import mockit.NonStrictExpectations; -import org.apache.drill.common.config.DrillConfig; +import static org.junit.Assert.assertEquals; + +import java.util.List; + import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.exception.SchemaChangeException; -import org.apache.drill.exec.expr.fn.FunctionImplementationRegistry; -import org.apache.drill.exec.memory.TopLevelAllocator; -import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry; -import org.apache.drill.exec.physical.impl.OutputMutator; import org.apache.drill.exec.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.BitControl; -import org.apache.drill.exec.proto.UserProtos; -import org.apache.drill.exec.record.BatchSchema; -import org.apache.drill.exec.record.MaterializedField; import org.apache.drill.exec.record.RecordBatchLoader; -import org.apache.drill.exec.record.VectorContainer; 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.store.RecordReader; import org.apache.drill.exec.util.VectorUtil; -import org.apache.drill.exec.vector.ValueVector; -import org.apache.hadoop.fs.Path; -import org.apache.hadoop.mapred.FileSplit; -import org.junit.AfterClass; -import org.junit.Ignore; import org.junit.Test; -import java.util.List; - -import static org.junit.Assert.assertEquals; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TextRecordReaderTest extends PopUnitTestBase { diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestAdaptiveAllocation.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestAdaptiveAllocation.java index f554e3f85..ebc4df76f 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestAdaptiveAllocation.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/TestAdaptiveAllocation.java @@ -17,21 +17,17 @@ */ package org.apache.drill.exec.vector; +import static org.junit.Assert.assertTrue; + +import java.util.Random; + import org.apache.drill.common.types.TypeProtos.MinorType; import org.apache.drill.common.types.Types; import org.apache.drill.exec.memory.BufferAllocator; import org.apache.drill.exec.memory.TopLevelAllocator; 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; -import java.util.Random; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class TestAdaptiveAllocation { @Test diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexToJson.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexToJson.java index 7c7ce2d4f..eedbf6f41 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexToJson.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexToJson.java @@ -17,6 +17,9 @@ */ package org.apache.drill.exec.vector.complex.writer; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.List; import org.apache.drill.BaseTestQuery; @@ -27,9 +30,6 @@ import org.apache.drill.exec.record.RecordBatchLoader; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class TestComplexToJson extends BaseTestQuery { @Test @@ -38,7 +38,7 @@ public class TestComplexToJson extends BaseTestQuery { List<QueryResultBatch> results; RecordBatchLoader loader = new RecordBatchLoader(getAllocator()); - + client = new DrillClient(config, serviceSet.getCoordinator()); client.setSupportComplexTypes(false); client.connect(); diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeWriter.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeWriter.java index 9011ff322..cb7bef259 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeWriter.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestComplexTypeWriter.java @@ -31,7 +31,7 @@ public class TestComplexTypeWriter extends BaseTestQuery{ } @Test - //map contains int, float, repeated list , repeated map, nested repeated map, etc. + //map contains int, float, repeated list , repeated map, nested repeated map, etc. public void testA1() throws Exception{ test(" select convert_from('{x:100, y:215.6, z: [1, 2, 3], s : [[5, 6, 7], [8, 9]], " + " t : [{a : 100, b: 200}, {a:300, b: 400}], " + @@ -40,55 +40,55 @@ public class TestComplexTypeWriter extends BaseTestQuery{ } @Test - //two convert functions. + //two convert functions. public void testA2() throws Exception{ test(" select convert_from('{x:100, y:215.6}' ,'JSON') as mycol1, convert_from('{x:100, y:215.6}' ,'JSON') as mycol2 from cp.`tpch/nation.parquet`;"); } @Test - //two convert functions. One convert's input comes from a string concat function. + //two convert functions. One convert's input comes from a string concat function. public void testA3() throws Exception{ test(" select convert_from(concat('{x:100,', 'y:215.6}') ,'JSON') as mycol1, convert_from('{x:100, y:215.6}' ,'JSON') as mycol2 from cp.`tpch/nation.parquet`;"); } - @Test + @Test //two convert functions. One's input is an empty map. public void testA4() throws Exception{ test(" select convert_from('{}' ,'JSON') as mycol1, convert_from('{x:100, y:215.6}' ,'JSON') as mycol2 from cp.`tpch/nation.parquet`;"); } - @Test + @Test //two convert functions. One's input is an empty list ( ok to have null in the result?) public void testA5() throws Exception{ test(" select convert_from('[]' ,'JSON') as mycol1, convert_from('{x:100, y:215.6}' ,'JSON') as mycol2 from cp.`tpch/nation.parquet`;"); } - @Test - //input is a list of BigInt. Output will be a repeated list vector. + @Test + //input is a list of BigInt. Output will be a repeated list vector. public void testA6() throws Exception{ test(" select convert_from('[1, 2, 3]' ,'JSON') as mycol1 from cp.`tpch/nation.parquet`;"); } - @Test - //input is a list of float. Output will be a repeated list vector. + @Test + //input is a list of float. Output will be a repeated list vector. public void testA7() throws Exception{ test(" select convert_from('[1.2, 2.3, 3.5]' ,'JSON') as mycol1 from cp.`tpch/nation.parquet`;"); } - @Test - //input is a list of list of big int. Output will be a repeated list vector. + @Test + //input is a list of list of big int. Output will be a repeated list vector. public void testA8() throws Exception{ test(" select convert_from('[ [1, 2], [3, 4], [5]]' ,'JSON') as mycol1 from cp.`tpch/nation.parquet`;"); } - @Test - //input is a list of map. Output will be a repeated list vector. + @Test + //input is a list of map. Output will be a repeated list vector. public void testA9() throws Exception{ test(" select convert_from('[{a : 100, b: 200}, {a:300, b: 400}]' ,'JSON') as mycol1 from cp.`tpch/nation.parquet`;"); } - + @Test - //two convert functions, one regular nest functions, used with Filter op. + //two convert functions, one regular nest functions, used with Filter op. public void testA10() throws Exception{ test(" select convert_from('{x:100, y:215.6}' ,'JSON') as mycol1, " + " convert_from('{x:200, y:678.9}' ,'JSON') as mycol2, " + @@ -97,16 +97,16 @@ public class TestComplexTypeWriter extends BaseTestQuery{ } @Test - //convert from string constructed from columns in parquet file. + //convert from string constructed from columns in parquet file. public void testA11() throws Exception{ - test(" select convert_from(concat(concat('{ NationName: \"', N_NAME) , '\"}'), 'JSON')" + + test(" select convert_from(concat(concat('{ NationName: \"', N_NAME) , '\"}'), 'JSON')" + " from cp.`tpch/nation.parquet` where n_nationkey > 5;"); } @Test - //Test multiple batches creation ( require multiple alloc for complex writer during Project ). + //Test multiple batches creation ( require multiple alloc for complex writer during Project ). public void testA100() throws Exception{ - test(" select convert_from(concat(concat('{ Price : ', L_EXTENDEDPRICE) , '}') , 'JSON') " + + test(" select convert_from(concat(concat('{ Price : ', L_EXTENDEDPRICE) , '}') , 'JSON') " + " from cp.`tpch/lineitem.parquet` limit 10; "); } diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java index 10b177542..c92495f03 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java @@ -19,16 +19,13 @@ package org.apache.drill.exec.vector.complex.writer; import static org.jgroups.util.Util.assertTrue; import static org.junit.Assert.assertEquals; -import io.netty.buffer.DrillBuf; import static org.junit.Assert.assertNull; +import io.netty.buffer.DrillBuf; import java.io.ByteArrayOutputStream; -import java.io.IOException; import java.util.List; -import com.google.common.io.Files; import org.apache.drill.BaseTestQuery; -import org.apache.drill.common.expression.PathSegment; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.exception.SchemaChangeException; @@ -40,12 +37,9 @@ 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.vector.IntVector; -import org.apache.drill.exec.vector.NullableBigIntVector; import org.apache.drill.exec.vector.NullableIntVector; import org.apache.drill.exec.vector.RepeatedBigIntVector; -import org.apache.drill.exec.vector.ValueVector; import org.apache.drill.exec.vector.complex.MapVector; -import org.apache.drill.exec.vector.complex.fn.JsonReader; import org.apache.drill.exec.vector.complex.fn.JsonReaderWithState; import org.apache.drill.exec.vector.complex.fn.JsonWriter; import org.apache.drill.exec.vector.complex.fn.ReaderJSONRecordSplitter; @@ -53,13 +47,13 @@ import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl; import org.apache.drill.exec.vector.complex.reader.FieldReader; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.google.common.base.Charsets; import com.google.common.collect.Lists; +import com.google.common.io.Files; public class TestJsonReader extends BaseTestQuery { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJsonReader.class); 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 9c2e3b796..a85a8410e 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 @@ -28,7 +28,6 @@ import org.apache.drill.exec.vector.complex.MapVector; import org.apache.drill.exec.vector.complex.fn.JsonWriter; import org.apache.drill.exec.vector.complex.impl.ComplexWriterImpl; import org.apache.drill.exec.vector.complex.reader.FieldReader; -import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ListWriter; import org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter; import org.junit.AfterClass; diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java index 28d8e39ca..b01b3e0b2 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/work/batch/TestSpoolingBuffer.java @@ -17,24 +17,21 @@ */ package org.apache.drill.exec.work.batch; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.google.common.io.Resources; +import static org.junit.Assert.assertEquals; + +import java.util.List; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.util.FileUtils; import org.apache.drill.exec.ExecTest; import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.proto.UserProtos; import org.apache.drill.exec.rpc.user.QueryResultBatch; import org.apache.drill.exec.server.Drillbit; import org.apache.drill.exec.server.RemoteServiceSet; import org.junit.Test; -import java.net.URL; -import java.util.List; - -import static org.junit.Assert.assertEquals; +import com.google.common.base.Charsets; +import com.google.common.io.Files; public class TestSpoolingBuffer extends ExecTest { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSpoolingBuffer.class); |