http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillConvertletTable.java ---------------------------------------------------------------------- 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 f1bda60..7c89897 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<>();
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillExtractConvertlet.java ---------------------------------------------------------------------- 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 d2559e7..31aa364 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(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java ---------------------------------------------------------------------- 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 e34d3d1..85a5734 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlAggOperator.java ---------------------------------------------------------------------- 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 299712e..0b8668b 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)); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillSqlOperator.java ---------------------------------------------------------------------- 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 2eeb26e..55a8595 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicReturnType.java ---------------------------------------------------------------------- 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 ee13330..1fe1d27 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()); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DynamicType.java ---------------------------------------------------------------------- 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 5b65565..7255dae 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/FixedRange.java ---------------------------------------------------------------------- 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 d68b8f2..91a7c65 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 http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/AbstractSqlHandler.java ---------------------------------------------------------------------- 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 3504505..8a52796 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java ---------------------------------------------------------------------- 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 b7d9bd7..66d4963 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) { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java ---------------------------------------------------------------------- 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 994eea4..e63474f 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/SetOptionHandler.java ---------------------------------------------------------------------- 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 028f569..da85a31 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFileHandler.java ---------------------------------------------------------------------- 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 17e80bd..3627a7b 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 { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ShowFilesCommandResult.java ---------------------------------------------------------------------- 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 bcd3055..949d972 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 { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java ---------------------------------------------------------------------- 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 86eb69d..ec5e2c9 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillCompoundIdentifier.java ---------------------------------------------------------------------- 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 d718efa..d5fa215 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{ http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillParserUtil.java ---------------------------------------------------------------------- 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 ed36903..b3fec9d 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. http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/DrillSqlCall.java ---------------------------------------------------------------------- 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 5fa592a..4005b81 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateTable.java ---------------------------------------------------------------------- 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 0170735..c4180a9 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlCreateView.java ---------------------------------------------------------------------- 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 3666b4c..ee96801 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDescribeTable.java ---------------------------------------------------------------------- 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 15da822..e1cda4f 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlDropView.java ---------------------------------------------------------------------- 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 1d94390..9b9e785 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowFiles.java ---------------------------------------------------------------------- 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 690e5fd..50bbca3 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowSchemas.java ---------------------------------------------------------------------- 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 faa69d1..7ccc917 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlShowTables.java ---------------------------------------------------------------------- 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 e66199a..15adb60 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/SqlUseSchema.java ---------------------------------------------------------------------- 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 76c7df3..ed4695e 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]); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/impl/DrillParserWithCompoundIdConverter.java ---------------------------------------------------------------------- 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 382456a..18f1edc 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 { /** http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/torel/ConversionContext.java ---------------------------------------------------------------------- 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 7456214..a486369 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); } - + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/DrillFixedRelDataTypeImpl.java ---------------------------------------------------------------------- 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 3c3a5ba..8df342e 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. http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/planner/types/RelDataTypeDrillImpl.java ---------------------------------------------------------------------- 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 bb97992..ce67cb2 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(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/AbstractSingleRecordBatch.java ---------------------------------------------------------------------- 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 bea7bbf..9054e3f 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/BatchSchema.java ---------------------------------------------------------------------- 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 5af3fb8..7299274 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/ExpandableHyperContainer.java ---------------------------------------------------------------------- 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 48f84ab..b8c5a8f 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() { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/FragmentWritableBatch.java ---------------------------------------------------------------------- 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 e85eab1..f0453d9 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; - + } - - - - + + + + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/HyperVectorWrapper.java ---------------------------------------------------------------------- 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 b44a233..7872e08 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/MajorTypeSerDe.java ---------------------------------------------------------------------- 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 a080d96..54e1136 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(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatch.java ---------------------------------------------------------------------- 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 dbf17c4..dd0f89a 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/RawFragmentBatchProvider.java ---------------------------------------------------------------------- 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 acbd8bd..d4dfe96 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(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java ---------------------------------------------------------------------- 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 9b28179..4189576 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 http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/SchemaBuilder.java ---------------------------------------------------------------------- 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 f405585..78214db 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/TypedFieldId.java ---------------------------------------------------------------------- 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 3154e6e..acb56d6 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorAccessible.java ---------------------------------------------------------------------- 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 474a0a6..880099c 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. http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/VectorContainer.java index 49c7399..ef09f39 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector2.java ---------------------------------------------------------------------- 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 1043011..7a7c012 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4.java ---------------------------------------------------------------------- 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 1433dc6..fd0932c 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; } } - - + + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/record/selection/SelectionVector4Builder.java ---------------------------------------------------------------------- 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 98e10ed..8de9948 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{ - + } } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/DefaultFunctionResolver.java ---------------------------------------------------------------------- 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 a461a55..9f02d74 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; } - + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolver.java ---------------------------------------------------------------------- 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 b2d576b..2bd80a5 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); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/FunctionResolverFactory.java ---------------------------------------------------------------------- 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 a710e44..fa5a3ce 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(); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/ResolverTypePrecedence.java ---------------------------------------------------------------------- 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 68a1643..838c49c 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>(); http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java ---------------------------------------------------------------------- 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 93f5b6d..d1ed95e 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/AbstractHandshakeHandler.java ---------------------------------------------------------------------- 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 56267df..78e4c10 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/Acks.java ---------------------------------------------------------------------- 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 8429fb1..3656717 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(); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BaseRpcOutcomeListener.java ---------------------------------------------------------------------- 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 fd4dd18..10ae6e3 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) { } - - + + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClient.java ---------------------------------------------------------------------- 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 3dc90b9..f358097 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicClientWithConnection.java ---------------------------------------------------------------------- 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 d50a64e..08819ca 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; } - - + + } - + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/BasicServer.java ---------------------------------------------------------------------- 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 b08685b..c00df4e 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; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ChannelClosedException.java ---------------------------------------------------------------------- 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 20994c2..b68efae 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); } - + } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/CoordinationQueue.java ---------------------------------------------------------------------- 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 2bce738..f7b3969 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) { http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFuture.java ---------------------------------------------------------------------- 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 d969604..d044432 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(); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/DrillRpcFutureImpl.java ---------------------------------------------------------------------- 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 e87ed18..291c71a 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 http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/FutureBitCommand.java ---------------------------------------------------------------------- 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 fe5d12d..6c7bf3e 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); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/InboundRpcMessage.java ---------------------------------------------------------------------- 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 8fc446f..012b9e4 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); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/ListeningCommand.java ---------------------------------------------------------------------- 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 acb696c..e32ca8a 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); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/OutboundRpcMessage.java ---------------------------------------------------------------------- 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 a4c5ef9..ef966cb 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){ http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/39990292/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/PositiveAtomicInteger.java ---------------------------------------------------------------------- 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 1b32646..401663d 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; } } - + }
