You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2014/09/12 17:17:44 UTC
[35/37] DRILL-1402: Add check-style rules for trailing space,
TABs and blocks without braces
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java b/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
index e8fdebf..ce9603e 100644
--- a/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
+++ b/common/src/main/java/org/apache/drill/common/logical/PlanProperties.java
@@ -30,19 +30,19 @@ public class PlanProperties {
public PlanType type;
public int version;
- public Generator generator;
- public ResultMode resultMode;
+ public Generator generator;
+ public ResultMode resultMode;
public JSONOptions options;
public int queue;
-// @JsonInclude(Include.NON_NULL)
- public static class Generator{
- public String type;
- public String info;
+// @JsonInclude(Include.NON_NULL)
+ public static class Generator {
+ public String type;
+ public String info;
- public static enum ResultMode{
- EXEC, LOGICAL, PHYSICAL;
- }
+ public static enum ResultMode {
+ EXEC, LOGICAL, PHYSICAL;
+ }
private Generator(@JsonProperty("type") String type, @JsonProperty("info") String info) {
this.type = type;
@@ -92,17 +92,17 @@ public class PlanProperties {
return this;
}
- public PlanPropertiesBuilder resultMode(ResultMode mode){
+ public PlanPropertiesBuilder resultMode(ResultMode mode) {
this.mode = mode;
return this;
}
- public PlanPropertiesBuilder queue(int queueNumber){
+ public PlanPropertiesBuilder queue(int queueNumber) {
this.queueNumber = queueNumber;
return this;
}
- public PlanPropertiesBuilder options(JSONOptions options){
+ public PlanPropertiesBuilder options(JSONOptions options) {
this.options = options;
return this;
}
@@ -115,5 +115,7 @@ public class PlanProperties {
public PlanProperties build() {
return new PlanProperties(version, generator, type, mode, options, queueNumber);
}
+
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Filter.java b/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
index 613c500..02737f8 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Filter.java
@@ -28,10 +28,10 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.collect.Iterators;
@JsonTypeName("filter")
-public class Filter extends SingleInputOperator{
- private final LogicalExpression expr;
+public class Filter extends SingleInputOperator {
+ private final LogicalExpression expr;
- @JsonCreator
+ @JsonCreator
public Filter(@JsonProperty("expr") LogicalExpression expr) {
this.expr = expr;
}
@@ -50,6 +50,4 @@ public class Filter extends SingleInputOperator{
return Iterators.singletonIterator(getInput());
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Join.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Join.java b/common/src/main/java/org/apache/drill/common/logical/data/Join.java
index ee5b527..df7e583 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Join.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Join.java
@@ -40,10 +40,11 @@ public class Join extends LogicalOperatorBase {
private final JoinRelType type;
private final JoinCondition[] conditions;
- public static JoinRelType resolve(String val){
+ public static JoinRelType resolve(String val) {
for (JoinRelType jt : JoinRelType.values()) {
- if (jt.name().equalsIgnoreCase(val))
+ if (jt.name().equalsIgnoreCase(val)) {
return jt;
+ }
}
throw new ExpressionParsingException(String.format("Unable to determine join type for value '%s'.", val));
}
@@ -97,7 +98,7 @@ public class Join extends LogicalOperatorBase {
return Iterators.forArray(getLeft(), getRight());
}
- public static Builder builder(){
+ public static Builder builder() {
return new Builder();
}
@@ -107,26 +108,25 @@ public class Join extends LogicalOperatorBase {
private JoinRelType type;
private List<JoinCondition> conditions = Lists.newArrayList();
- public Builder type(JoinRelType type){
+ public Builder type(JoinRelType type) {
this.type = type;
return this;
}
- public Builder left(LogicalOperator left){
+ public Builder left(LogicalOperator left) {
this.left = left;
return this;
}
- public Builder right(LogicalOperator right){
+ public Builder right(LogicalOperator right) {
this.right = right;
return this;
}
- public Builder addCondition(String relationship, LogicalExpression left, LogicalExpression right){
+ public Builder addCondition(String relationship, LogicalExpression left, LogicalExpression right) {
conditions.add(new JoinCondition(relationship, left, right));
return this;
}
-
@Override
public Join build() {
Preconditions.checkNotNull(left);
@@ -136,4 +136,5 @@ public class Join extends LogicalOperatorBase {
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java b/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
index cbfa066..58a00fe 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/LogicalOperatorBase.java
@@ -34,18 +34,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public abstract class LogicalOperatorBase implements LogicalOperator{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(LogicalOperatorBase.class);
- private List<LogicalOperator> children = new ArrayList<LogicalOperator>();
- private String memo;
+ private List<LogicalOperator> children = new ArrayList<LogicalOperator>();
- @Override
- public final int hashCode(){
- return super.hashCode();
- }
+ private String memo;
- @Override
- public void setupAndValidate(List<LogicalOperator> operators, Collection<ValidationError> errors) {
- // TODO: remove this and implement individually.
- }
+ @Override
+ public final int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public void setupAndValidate(List<LogicalOperator> operators, Collection<ValidationError> errors) {
+ // TODO: remove this and implement individually.
+ }
@Override
public NodeBuilder nodeBuilder() {
@@ -55,14 +56,18 @@ public abstract class LogicalOperatorBase implements LogicalOperator{
@Override
public void accept(GraphVisitor<LogicalOperator> visitor) {
- if(visitor.enter(this)) visitor.leave(this);
+ if (visitor.enter(this)) {
+ visitor.leave(this);
+ }
}
- @Override
- public void registerAsSubscriber(LogicalOperator operator) {
- if(operator == null) throw new IllegalArgumentException("You attempted to register a null operators.");
- children.add(operator);
+ @Override
+ public void registerAsSubscriber(LogicalOperator operator) {
+ if (operator == null) {
+ throw new IllegalArgumentException("You attempted to register a null operators.");
}
+ children.add(operator);
+ }
@Override
public String toString() {
@@ -71,7 +76,7 @@ public abstract class LogicalOperatorBase implements LogicalOperator{
@JsonInclude(Include.NON_EMPTY)
@JsonProperty("memo")
- public String getMemo(){
+ public String getMemo() {
return memo;
}
@@ -79,13 +84,10 @@ public abstract class LogicalOperatorBase implements LogicalOperator{
this.memo = memo;
}
- public synchronized static Class<?>[] getSubTypes(DrillConfig config){
+ public synchronized static Class<?>[] getSubTypes(DrillConfig config) {
Class<?>[] ops = PathScanner.scanForImplementationsArr(LogicalOperator.class, config.getStringList(CommonConstants.LOGICAL_OPERATOR_SCAN_PACKAGES));
logger.debug("Adding Logical Operator sub types: {}", ((Object) ops) );
return ops;
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Project.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Project.java b/common/src/main/java/org/apache/drill/common/logical/data/Project.java
index 5a78ee5..4345c80 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Project.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Project.java
@@ -37,7 +37,7 @@ public class Project extends SingleInputOperator {
@JsonCreator
public Project(@JsonProperty("projections") NamedExpression[] selections) {
this.selections = selections;
- if (selections == null || selections.length == 0)
+ if (selections == null || selections.length == 0) {
throw new ExpressionParsingException(
"Project did not provide any projection selections. At least one projection must be provided.");
// for (int i = 0; i < selections.length; i++) {
@@ -51,6 +51,7 @@ public class Project extends SingleInputOperator {
// path, segment.isNamed()));
//
// }
+ }
}
@JsonProperty("projections")
@@ -87,4 +88,5 @@ public class Project extends SingleInputOperator {
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Scan.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Scan.java b/common/src/main/java/org/apache/drill/common/logical/data/Scan.java
index 50b53d4..68eabbb 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Scan.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Scan.java
@@ -24,13 +24,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
-
@JsonTypeName("scan")
-public class Scan extends SourceOperator{
- private final String storageEngine;
- private final JSONOptions selection;
+public class Scan extends SourceOperator {
+ private final String storageEngine;
+ private final JSONOptions selection;
- @JsonCreator
+ @JsonCreator
public Scan(@JsonProperty("storageengine") String storageEngine, @JsonProperty("selection") JSONOptions selection) {
super();
this.storageEngine = storageEngine;
@@ -55,7 +54,6 @@ public class Scan extends SourceOperator{
return new Builder();
}
-
public static class Builder extends AbstractBuilder<Scan>{
private String storageEngine;
private JSONOptions selection;
@@ -74,6 +72,7 @@ public class Scan extends SourceOperator{
public Scan build() {
return new Scan(storageEngine, selection);
}
+
}
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Sequence.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Sequence.java b/common/src/main/java/org/apache/drill/common/logical/data/Sequence.java
index 6bacdff..f04b09c 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Sequence.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Sequence.java
@@ -52,7 +52,7 @@ import com.google.common.collect.Iterators;
public class Sequence extends LogicalOperatorBase {
static final Logger logger = LoggerFactory.getLogger(Sequence.class);
- private Sequence(){}
+ private Sequence() {}
public boolean openTop;
public LogicalOperator input;
@@ -69,7 +69,6 @@ public class Sequence extends LogicalOperatorBase {
return Iterators.singletonIterator(stream[stream.length - 1]);
}
-
public static class De extends StdDeserializer<LogicalOperator> {
protected De() {
@@ -101,11 +100,12 @@ public class Sequence extends LogicalOperatorBase {
break;
case "do":
- if (!jp.isExpectedStartArrayToken())
+ if (!jp.isExpectedStartArrayToken()) {
throwE(
jp,
"The do parameter of sequence should be an array of SimpleOperators. Expected a JsonToken.START_ARRAY token but received a "
+ t.name() + "token.");
+ }
int pos = 0;
while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
@@ -119,16 +119,18 @@ public class Sequence extends LogicalOperatorBase {
LogicalOperator o = jp.readValueAs(LogicalOperator.class);
if (pos == 0) {
- if (!(o instanceof SingleInputOperator) && !(o instanceof SourceOperator))
+ if (!(o instanceof SingleInputOperator) && !(o instanceof SourceOperator)) {
throwE(
l,
"The first operator in a sequence must be either a ZeroInput or SingleInput operator. The provided first operator was not. It was of type "
+ o.getClass().getName());
+ }
first = o;
} else {
- if (!(o instanceof SingleInputOperator))
+ if (!(o instanceof SingleInputOperator)) {
throwE(l, "All operators after the first must be single input operators. The operator at position "
+ pos + " was not. It was of type " + o.getClass().getName());
+ }
SingleInputOperator now = (SingleInputOperator) o;
now.setInput(prev);
}
@@ -147,12 +149,14 @@ public class Sequence extends LogicalOperatorBase {
}
}
- if (first == null)
+ if (first == null) {
throwE(start, "A sequence must include at least one operator.");
+ }
if ((parent == null && first instanceof SingleInputOperator)
- || (parent != null && first instanceof SourceOperator))
+ || (parent != null && first instanceof SourceOperator)) {
throwE(start,
"A sequence must either start with a ZeroInputOperator or have a provided input. It cannot have both or neither.");
+ }
if (parent != null && first instanceof SingleInputOperator) {
((SingleInputOperator) first).setInput(parent);
@@ -179,4 +183,5 @@ public class Sequence extends LogicalOperatorBase {
private static void throwE(JsonParser jp, String e) throws JsonParseException {
throw new JsonParseException(e, jp.getCurrentLocation());
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/SingleInputOperator.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/SingleInputOperator.java b/common/src/main/java/org/apache/drill/common/logical/data/SingleInputOperator.java
index 98db733..e46cb6b 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/SingleInputOperator.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/SingleInputOperator.java
@@ -38,12 +38,13 @@ public abstract class SingleInputOperator extends LogicalOperatorBase {
@JsonProperty(value="input", required=true)
public void setInput(LogicalOperator input) {
- if(input instanceof SinkOperator) throw new UnexpectedOperatorType("You have set the input of a sink node of type ["+input.getClass().getSimpleName()+ "] as the input for another node of type ["+this.getClass().getSimpleName()+ "]. This is invalid.");
+ if (input instanceof SinkOperator) {
+ throw new UnexpectedOperatorType("You have set the input of a sink node of type ["+input.getClass().getSimpleName()+ "] as the input for another node of type ["+this.getClass().getSimpleName()+ "]. This is invalid.");
+ }
this.input = input;
input.registerAsSubscriber(this);
}
-
@Override
public Iterator<LogicalOperator> iterator() {
return Iterators.singletonIterator(input);
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/logical/data/Transform.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/logical/data/Transform.java b/common/src/main/java/org/apache/drill/common/logical/data/Transform.java
index 02496a6..129ae2c 100644
--- a/common/src/main/java/org/apache/drill/common/logical/data/Transform.java
+++ b/common/src/main/java/org/apache/drill/common/logical/data/Transform.java
@@ -27,12 +27,12 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.collect.Iterators;
@JsonTypeName("transform")
-public class Transform extends SingleInputOperator{
+public class Transform extends SingleInputOperator {
- private final NamedExpression[] transforms;
+ private final NamedExpression[] transforms;
- @JsonCreator
- public Transform(@JsonProperty("transforms") NamedExpression[] transforms) {
+ @JsonCreator
+ public Transform(@JsonProperty("transforms") NamedExpression[] transforms) {
super();
this.transforms = transforms;
}
@@ -41,15 +41,14 @@ public class Transform extends SingleInputOperator{
return transforms;
}
- @Override
- public <T, X, E extends Throwable> T accept(LogicalVisitor<T, X, E> logicalVisitor, X value) throws E {
- return logicalVisitor.visitTransform(this, value);
- }
-
- @Override
- public Iterator<LogicalOperator> iterator() {
- return Iterators.singletonIterator(getInput());
- }
+ @Override
+ public <T, X, E extends Throwable> T accept(LogicalVisitor<T, X, E> logicalVisitor, X value) throws E {
+ return logicalVisitor.visitTransform(this, value);
+ }
+ @Override
+ public Iterator<LogicalOperator> iterator() {
+ return Iterators.singletonIterator(getInput());
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/types/Types.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/types/Types.java b/common/src/main/java/org/apache/drill/common/types/Types.java
index 2d90b67..8ae3edd 100644
--- a/common/src/main/java/org/apache/drill/common/types/Types.java
+++ b/common/src/main/java/org/apache/drill/common/types/Types.java
@@ -33,12 +33,12 @@ public class Types {
public static final MajorType REQUIRED_BIT = required(MinorType.BIT);
public static final MajorType OPTIONAL_BIT = optional(MinorType.BIT);
- public static enum Comparability{
+ public static enum Comparability {
UNKNOWN, NONE, EQUAL, ORDERED;
}
- public static boolean isComplex(MajorType type){
- switch(type.getMinorType()){
+ public static boolean isComplex(MajorType type) {
+ switch(type.getMinorType()) {
case LIST:
case MAP:
return true;
@@ -47,14 +47,16 @@ public class Types {
return false;
}
- public static boolean isRepeated(MajorType type){
+ public static boolean isRepeated(MajorType type) {
return type.getMode() == REPEATED ;
}
- public static boolean isNumericType(MajorType type){
- if(type.getMode() == REPEATED) return false;
+ public static boolean isNumericType(MajorType type) {
+ if (type.getMode() == REPEATED) {
+ return false;
+ }
- switch(type.getMinorType()){
+ switch(type.getMinorType()) {
case BIGINT:
case DECIMAL38SPARSE:
case DECIMAL38DENSE:
@@ -78,10 +80,12 @@ public class Types {
}
}
- public static int getSqlType(MajorType type){
- if(type.getMode() == DataMode.REPEATED) return java.sql.Types.ARRAY;
+ public static int getSqlType(MajorType type) {
+ if (type.getMode() == DataMode.REPEATED) {
+ return java.sql.Types.ARRAY;
+ }
- switch(type.getMinorType()){
+ switch(type.getMinorType()) {
case BIGINT:
return java.sql.Types.BIGINT;
case BIT:
@@ -146,8 +150,8 @@ public class Types {
}
}
- public static boolean isUnSigned(MajorType type){
- switch(type.getMinorType()){
+ public static boolean isUnSigned(MajorType type) {
+ switch(type.getMinorType()) {
case UINT1:
case UINT2:
case UINT4:
@@ -158,9 +162,11 @@ public class Types {
}
}
- public static boolean usesHolderForGet(MajorType type){
- if(type.getMode() == REPEATED) return true;
- switch(type.getMinorType()){
+ public static boolean usesHolderForGet(MajorType type) {
+ if (type.getMode() == REPEATED) {
+ return true;
+ }
+ switch(type.getMinorType()) {
case BIGINT:
case FLOAT4:
case FLOAT8:
@@ -184,8 +190,8 @@ public class Types {
}
- public static boolean isFixedWidthType(MajorType type){
- switch(type.getMinorType()){
+ public static boolean isFixedWidthType(MajorType type) {
+ switch(type.getMinorType()) {
case VARBINARY:
case VAR16CHAR:
case VARCHAR:
@@ -196,9 +202,11 @@ public class Types {
}
- public static boolean isStringScalarType(MajorType type){
- if(type.getMode() == REPEATED) return false;
- switch(type.getMinorType()){
+ public static boolean isStringScalarType(MajorType type) {
+ if (type.getMode() == REPEATED) {
+ return false;
+ }
+ switch(type.getMinorType()) {
case FIXEDCHAR:
case FIXED16CHAR:
case VARCHAR:
@@ -209,9 +217,11 @@ public class Types {
}
}
- public static boolean isBytesScalarType(MajorType type){
- if(type.getMode() == REPEATED) return false;
- switch(type.getMinorType()){
+ public static boolean isBytesScalarType(MajorType type) {
+ if (type.getMode() == REPEATED) {
+ return false;
+ }
+ switch(type.getMinorType()) {
case FIXEDBINARY:
case VARBINARY:
return true;
@@ -220,11 +230,15 @@ public class Types {
}
}
- public static Comparability getComparability(MajorType type){
- if(type.getMode() == REPEATED) return Comparability.NONE;
- if(type.getMinorType() == MinorType.LATE) return Comparability.UNKNOWN;
+ public static Comparability getComparability(MajorType type) {
+ if (type.getMode() == REPEATED) {
+ return Comparability.NONE;
+ }
+ if (type.getMinorType() == MinorType.LATE) {
+ return Comparability.UNKNOWN;
+ }
- switch(type.getMinorType()){
+ switch(type.getMinorType()) {
case LATE:
return Comparability.UNKNOWN;
case MAP:
@@ -238,23 +252,23 @@ public class Types {
}
- public static boolean softEquals(MajorType a, MajorType b, boolean allowNullSwap){
- if(a.getMinorType() != b.getMinorType()){
- if(
+ public static boolean softEquals(MajorType a, MajorType b, boolean allowNullSwap) {
+ if (a.getMinorType() != b.getMinorType()) {
+ if (
(a.getMinorType() == MinorType.VARBINARY && b.getMinorType() == MinorType.VARCHAR) ||
(b.getMinorType() == MinorType.VARBINARY && a.getMinorType() == MinorType.VARCHAR)
- ){
+ ) {
// fall through;
- }else{
+ } else {
return false;
}
}
- if(allowNullSwap){
- switch(a.getMode()){
+ if(allowNullSwap) {
+ switch (a.getMode()) {
case OPTIONAL:
case REQUIRED:
- switch(b.getMode()){
+ switch (b.getMode()) {
case OPTIONAL:
case REQUIRED:
return true;
@@ -264,11 +278,11 @@ public class Types {
return a.getMode() == b.getMode();
}
- public static boolean isLateBind(MajorType type){
+ public static boolean isLateBind(MajorType type) {
return type.getMinorType() == MinorType.LATE;
}
- public static MajorType withMode(MinorType type, DataMode mode){
+ public static MajorType withMode(MinorType type, DataMode mode) {
return MajorType.newBuilder().setMode(mode).setMinorType(type).build();
}
@@ -276,20 +290,20 @@ public class Types {
return MajorType.newBuilder().setMinorType(type).setMode(mode).setScale(scale).setPrecision(precision).build();
}
- public static MajorType required(MinorType type){
+ public static MajorType required(MinorType type) {
return MajorType.newBuilder().setMode(DataMode.REQUIRED).setMinorType(type).build();
}
- public static MajorType repeated(MinorType type){
+ public static MajorType repeated(MinorType type) {
return MajorType.newBuilder().setMode(REPEATED).setMinorType(type).build();
}
- public static MajorType optional(MinorType type){
+ public static MajorType optional(MinorType type) {
return MajorType.newBuilder().setMode(DataMode.OPTIONAL).setMinorType(type).build();
}
public static MajorType overrideMinorType(MajorType originalMajorType, MinorType overrideMinorType) {
- switch(originalMajorType.getMode()) {
+ switch (originalMajorType.getMode()) {
case REPEATED:
return repeated(overrideMinorType);
case OPTIONAL:
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/util/ConstructorChecker.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/ConstructorChecker.java b/common/src/main/java/org/apache/drill/common/util/ConstructorChecker.java
index 7a6048b..9c24afa 100644
--- a/common/src/main/java/org/apache/drill/common/util/ConstructorChecker.java
+++ b/common/src/main/java/org/apache/drill/common/util/ConstructorChecker.java
@@ -25,31 +25,37 @@ public class ConstructorChecker {
private final String requirementString;
private final Class<?>[] classes;
-
public ConstructorChecker(Class<?>... classes) {
super();
this.classes = classes;
StringBuffer sb = new StringBuffer();
sb.append("The required constructor is (");
- for(int i =0; i < classes.length; i++){
- if(i != 0) sb.append(", ");
+ for (int i =0; i < classes.length; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
sb.append(classes[i].getName());
}
this.requirementString = sb.toString();
}
- public boolean check(Constructor<?> c){
+ public boolean check(Constructor<?> c) {
Class<?>[] params = c.getParameterTypes();
- if(params.length != classes.length) return false;
- for(int i =0; i < classes.length; i++){
- if( !classes[i].isAssignableFrom(params[i])) return false;
+ if (params.length != classes.length) {
+ return false;
+ }
+ for (int i =0; i < classes.length; i++) {
+ if ( !classes[i].isAssignableFrom(params[i])) {
+ return false;
+ }
}
return true;
}
- public String getRequirementString(){
+ public String getRequirementString() {
return requirementString;
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java
index 422e28f..63538d9 100644
--- a/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java
+++ b/common/src/main/java/org/apache/drill/common/util/DrillStringUtils.java
@@ -29,7 +29,9 @@ public class DrillStringUtils {
public static String readable(long bytes) {
int unit = 1024;
long absBytes = Math.abs(bytes);
- if (absBytes < unit) return bytes + " B";
+ if (absBytes < unit) {
+ return bytes + " B";
+ }
int exp = (int) (Math.log(absBytes) / Math.log(unit));
char pre = ("KMGTPE").charAt(exp-1);
return String.format("%s%.1f %ciB", (bytes == absBytes ? "" : "-"), absBytes / Math.pow(unit, exp), pre);
@@ -176,10 +178,11 @@ public class DrillStringUtils {
* @return The converted hex value as a byte.
*/
private static byte toBinaryFromHex(byte ch) {
- if ( ch >= 'A' && ch <= 'F' )
+ if ( ch >= 'A' && ch <= 'F' ) {
return (byte) ((byte)10 + (byte) (ch - 'A'));
- else if ( ch >= 'a' && ch <= 'f' )
+ } else if ( ch >= 'a' && ch <= 'f' ) {
return (byte) ((byte)10 + (byte) (ch - 'a'));
+ }
return (byte) (ch - '0');
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/FileUtils.java b/common/src/main/java/org/apache/drill/common/util/FileUtils.java
index 527162c..cd846f8 100644
--- a/common/src/main/java/org/apache/drill/common/util/FileUtils.java
+++ b/common/src/main/java/org/apache/drill/common/util/FileUtils.java
@@ -34,11 +34,14 @@ public class FileUtils {
public static File getResourceAsFile(String fileName) throws IOException {
URL u = FileUtils.class.getResource(fileName);
- if (u == null) throw new FileNotFoundException(String.format("Unable to find file on path %s", fileName));
+ if (u == null) {
+ throw new FileNotFoundException(String.format("Unable to find file on path %s", fileName));
+ }
return new File(u.getPath());
}
public static String getResourceAsString(String fileName) throws IOException {
return Files.toString(getResourceAsFile(fileName), Charsets.UTF_8);
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/java/org/apache/drill/common/util/PathScanner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/PathScanner.java b/common/src/main/java/org/apache/drill/common/util/PathScanner.java
index e7e48a4..6223777 100644
--- a/common/src/main/java/org/apache/drill/common/util/PathScanner.java
+++ b/common/src/main/java/org/apache/drill/common/util/PathScanner.java
@@ -48,50 +48,54 @@ public class PathScanner {
private static final Object SYNC = new Object();
static volatile Reflections REFLECTIONS = null;
- public static <A extends Annotation, T> Map<A, Class<? extends T>> scanForAnnotatedImplementations(Class<A> annotationClass, Class<T> baseClass, final List<String> scanPackages){
+ public static <A extends Annotation, T> Map<A, Class<? extends T>> scanForAnnotatedImplementations(Class<A> annotationClass, Class<T> baseClass, final List<String> scanPackages) {
Collection<Class<? extends T>> providerClasses = scanForImplementations(baseClass, scanPackages);
Map<A, Class<? extends T>> map = new HashMap<A, Class<? extends T>>();
for (Class<? extends T> c : providerClasses) {
A annotation = (A) c.getAnnotation(annotationClass);
- if(annotation == null) continue;
+ if (annotation == null) {
+ continue;
+ }
map.put(annotation, c);
}
return map;
}
- private static Reflections getReflections(){
- if(REFLECTIONS == null){
+ private static Reflections getReflections() {
+ if (REFLECTIONS == null) {
REFLECTIONS = new Reflections(new ConfigurationBuilder().setUrls(getMarkedPaths()).setScanners(subTypeScanner, annotationsScanner, resourcesScanner));
}
return REFLECTIONS;
}
- public static <T> Class<?>[] scanForImplementationsArr(Class<T> baseClass, final List<String> scanPackages){
+ public static <T> Class<?>[] scanForImplementationsArr(Class<T> baseClass, final List<String> scanPackages) {
Collection<Class<? extends T>> imps = scanForImplementations(baseClass, scanPackages);
return imps.toArray(new Class<?>[imps.size()]);
}
- public static <T> Set<Class<? extends T>> scanForImplementations(Class<T> baseClass, final List<String> scanPackages){
- synchronized(SYNC){
+ public static <T> Set<Class<? extends T>> scanForImplementations(Class<T> baseClass, final List<String> scanPackages) {
+ synchronized(SYNC) {
Set<Class<? extends T>> classes = getReflections().getSubTypesOf(baseClass);
- for(Iterator<Class<? extends T>> i = classes.iterator(); i.hasNext();){
+ for (Iterator<Class<? extends T>> i = classes.iterator(); i.hasNext();) {
Class<? extends T> c = i.next();
assert baseClass.isAssignableFrom(c);
- if(Modifier.isAbstract(c.getModifiers())) i.remove();
+ if (Modifier.isAbstract(c.getModifiers())) {
+ i.remove();
+ }
}
return classes;
}
}
- private static Collection<URL> getMarkedPaths(){
+ private static Collection<URL> getMarkedPaths() {
Collection<URL> urls = forResource(CommonConstants.DRILL_JAR_MARKER_FILE, true);
return urls;
}
- public static Collection<URL> getConfigURLs(){
+ public static Collection<URL> getConfigURLs() {
return forResource(CommonConstants.DRILL_JAR_MARKER_FILE, false);
}
@@ -122,7 +126,6 @@ public class PathScanner {
}
return result;
-}
-
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/main/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/common/src/main/resources/drill-module.conf b/common/src/main/resources/drill-module.conf
index b81ec6f..c01939c 100644
--- a/common/src/main/resources/drill-module.conf
+++ b/common/src/main/resources/drill-module.conf
@@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// This file tells Drill to consider this module when class path scanning.
-// This file can also include any supplementary configuration information.
+// This file tells Drill to consider this module when class path scanning.
+// This file can also include any supplementary configuration information.
// This file is in HOCON format, see https://github.com/typesafehub/config/blob/master/HOCON.md for more information.
drill.exec.storage.packages += org.apache.drill.exec.store.mock
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/java/org/apache/drill/test/DrillAssert.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/drill/test/DrillAssert.java b/common/src/test/java/org/apache/drill/test/DrillAssert.java
index ddd3b93..3510677 100644
--- a/common/src/test/java/org/apache/drill/test/DrillAssert.java
+++ b/common/src/test/java/org/apache/drill/test/DrillAssert.java
@@ -46,9 +46,15 @@ public class DrillAssert {
}
}
// skip newlines at the end
- while(idx1 < expected.length() && isNewLineChar(expected.charAt(idx1))) idx1++;
- while(idx2 < actual.length() && isNewLineChar(actual.charAt(idx2))) idx2++;
- if (idx1 == expected.length() && idx2 == actual.length()) return;
+ while(idx1 < expected.length() && isNewLineChar(expected.charAt(idx1))) {
+ idx1++;
+ }
+ while(idx2 < actual.length() && isNewLineChar(actual.charAt(idx2))) {
+ idx2++;
+ }
+ if (idx1 == expected.length() && idx2 == actual.length()) {
+ return;
+ }
}
fail(message != null ? message : "Expected: " + expected + ", but was: " + actual);
@@ -57,4 +63,5 @@ public class DrillAssert {
private static boolean isNewLineChar(char ch) {
return (ch == '\r' || ch == '\n');
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/basic_physical.json
----------------------------------------------------------------------
diff --git a/common/src/test/resources/basic_physical.json b/common/src/test/resources/basic_physical.json
index 4d1d329..21e4c9a 100644
--- a/common/src/test/resources/basic_physical.json
+++ b/common/src/test/resources/basic_physical.json
@@ -17,8 +17,8 @@
pop:"scan",
storageengine:"fs1",
entries:[
- {"test1"}
- ],
+ {"test1"}
+ ],
output:[
{ "name":"key", mode: "VECTOR", type:"SINT32"},
{ "name":"value", mode: "VECTOR", type:"SINT32"}
@@ -36,7 +36,7 @@
key:"Text",
type:"JAVA_SEQUENCE"
}
- ]
- }
+ ]
+ }
]
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/drill-module.conf
----------------------------------------------------------------------
diff --git a/common/src/test/resources/drill-module.conf b/common/src/test/resources/drill-module.conf
index 55e499d..5b9605a 100644
--- a/common/src/test/resources/drill-module.conf
+++ b/common/src/test/resources/drill-module.conf
@@ -5,9 +5,9 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http:// www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/dsort-logical.json
----------------------------------------------------------------------
diff --git a/common/src/test/resources/dsort-logical.json b/common/src/test/resources/dsort-logical.json
index 83d30e8..3e32ad6 100644
--- a/common/src/test/resources/dsort-logical.json
+++ b/common/src/test/resources/dsort-logical.json
@@ -16,7 +16,7 @@
orderings: [
{order: "desc", expr: "data.key" }
]
- },
+ },
{
op: "project",
projections: [
@@ -24,7 +24,7 @@
{ ref: "output.value", expr: "data.value" }
]
},
- {
+ {
op: "store",
storageengine: "fs1",
target: {
@@ -37,4 +37,4 @@
}
}
]}]
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/common/src/test/resources/logback.xml b/common/src/test/resources/logback.xml
index 7591034..a6a3dba 100644
--- a/common/src/test/resources/logback.xml
+++ b/common/src/test/resources/logback.xml
@@ -33,8 +33,8 @@
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>/logs/test-common.%d{yyyy-MM-dd}.log</fileNamePattern>
- <maxHistory>30</maxHistory>
+ <fileNamePattern>/logs/test-common.%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
-->
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/simple_plan.json
----------------------------------------------------------------------
diff --git a/common/src/test/resources/simple_plan.json b/common/src/test/resources/simple_plan.json
index 2457b1f..46ee6af 100644
--- a/common/src/test/resources/simple_plan.json
+++ b/common/src/test/resources/simple_plan.json
@@ -10,13 +10,13 @@
storage:{
logs: {
type:"text",
- file: "local://logs/*.log",
- compress:"gzip",
- line-delimiter:"\n",
- record-maker:{
- type:"first-row",
- delimiter:","
- }
+ file: "local://logs/*.log",
+ compress:"gzip",
+ line-delimiter:"\n",
+ record-maker:{
+ type:"first-row",
+ delimiter:","
+ }
},
{
type:"mongo",
@@ -125,9 +125,6 @@
target: {
file: "console:///stdout"
}
-
}
-
-
]
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/common/src/test/resources/storage_engine_plan.json
----------------------------------------------------------------------
diff --git a/common/src/test/resources/storage_engine_plan.json b/common/src/test/resources/storage_engine_plan.json
index 6be9deb..6c9a6d6 100644
--- a/common/src/test/resources/storage_engine_plan.json
+++ b/common/src/test/resources/storage_engine_plan.json
@@ -10,7 +10,7 @@
"storage" : {
"mock-engine": {
type : "mock",
- url : "http://www.apache.org/"
+ url : "http://www.apache.org/"
}
},
"query" : [
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
index d5dffdc..5a03063 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseGroupScan.java
@@ -172,7 +172,9 @@ public class HBaseGroupScan extends AbstractGroupScan implements DrillHBaseConst
}
private void verifyColumns() {
- if (AbstractRecordReader.isStarQuery(columns)) return;
+ if (AbstractRecordReader.isStarQuery(columns)) {
+ return;
+ }
for (SchemaPath column : columns) {
if (!(column.equals(ROW_KEY_PATH) || hTableDesc.hasFamily(HBaseUtils.getBytes(column.getRootSegment().getPath())))) {
DrillRuntimeException.format("The column family '%s' does not exist in HBase table: %s .",
@@ -279,7 +281,7 @@ public class HBaseGroupScan extends AbstractGroupScan implements DrillHBaseConst
for(List<HBaseSubScanSpec> listOfScan : endpointFragmentMapping.values()) {
if (listOfScan.size() < minPerEndpointSlot) {
minHeap.offer(listOfScan);
- } else if (listOfScan.size() > minPerEndpointSlot){
+ } else if (listOfScan.size() > minPerEndpointSlot) {
maxHeap.offer(listOfScan);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseUtils.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseUtils.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseUtils.java
index 10a7e64..3c8aee2 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseUtils.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseUtils.java
@@ -46,7 +46,9 @@ public class HBaseUtils {
}
static Filter parseFilterString(String filterString) {
- if (filterString == null) return null;
+ if (filterString == null) {
+ return null;
+ }
try {
return FILTER_PARSEER.parseFilterString(filterString);
} catch (CharacterCodingException e) {
@@ -55,8 +57,10 @@ public class HBaseUtils {
}
public static byte[] serializeFilter(Filter filter) {
- if (filter == null) return null;
- try(ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(byteStream)) {
+ if (filter == null) {
+ return null;
+ }
+ try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(byteStream)) {
HbaseObjectWritable.writeObject(out, filter, filter.getClass(), null);
return byteStream.toByteArray();
} catch (IOException e) {
@@ -65,8 +69,10 @@ public class HBaseUtils {
}
public static Filter deserializeFilter(byte[] filterBytes) {
- if (filterBytes == null) return null;
- try(DataInputStream dis = new DataInputStream(new ByteArrayInputStream(filterBytes));) {
+ if (filterBytes == null) {
+ return null;
+ }
+ try (DataInputStream dis = new DataInputStream(new ByteArrayInputStream(filterBytes));) {
return (Filter) HbaseObjectWritable.readObject(dis, null);
} catch (Exception e) {
throw new DrillRuntimeException("Error deserializing filter: " + filterBytes, e);
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseCFAsJSONString.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseCFAsJSONString.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseCFAsJSONString.java
index 4b4b648..6fe1525 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseCFAsJSONString.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseCFAsJSONString.java
@@ -40,7 +40,9 @@ public class TestHBaseCFAsJSONString extends BaseHBaseTest {
@AfterClass
public static void closeMyClient() throws IOException {
- if(client != null) client.close();
+ if (client != null) {
+ client.close();
+ }
client = parent_client;
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hbase/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/resources/logback.xml b/contrib/storage-hbase/src/test/resources/logback.xml
index 00cc85b..6ef172b 100644
--- a/contrib/storage-hbase/src/test/resources/logback.xml
+++ b/contrib/storage-hbase/src/test/resources/logback.xml
@@ -27,7 +27,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <!-- The property 'logback.log.dir' is defined in pom.xml -->
+ <!-- The property 'logback.log.dir' is defined in pom.xml -->
<file>${logback.log.dir:-./target/surefire-reports}/hbase-tests-${bySecond}.log</file>
<append>false</append>
<encoder>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
index 2643220..5fba542 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
@@ -52,14 +52,16 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
* (function name) --> (implementation class) mappings.
* @param config
*/
- public HiveFunctionRegistry(DrillConfig config){
+ public HiveFunctionRegistry(DrillConfig config) {
Set<Class<? extends GenericUDF>> genericUDFClasses = PathScanner.scanForImplementations(GenericUDF.class, null);
- for (Class<? extends GenericUDF> clazz : genericUDFClasses)
+ for (Class<? extends GenericUDF> clazz : genericUDFClasses) {
register(clazz, methodsGenericUDF);
+ }
Set<Class<? extends UDF>> udfClasses = PathScanner.scanForImplementations(UDF.class, null);
- for (Class<? extends UDF> clazz : udfClasses)
+ for (Class<? extends UDF> clazz : udfClasses) {
register(clazz, methodsUDF);
+ }
}
@Override
@@ -72,18 +74,22 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
Description desc = clazz.getAnnotation(Description.class);
String[] names;
- if(desc != null){
+ if (desc != null) {
names = desc.name().split(",");
- for(int i=0; i<names.length; i++) names[i] = names[i].trim();
+ for (int i=0; i<names.length; i++) {
+ names[i] = names[i].trim();
+ }
}else{
names = new String[]{clazz.getName().replace('.', '_')};
}
UDFType type = clazz.getAnnotation(UDFType.class);
- if (type != null && type.deterministic()) nonDeterministicUDFs.add(clazz);
+ if (type != null && type.deterministic()) {
+ nonDeterministicUDFs.add(clazz);
+ }
- for(int i=0; i<names.length;i++){
+ for(int i=0; i<names.length;i++) {
methods.put(names[i].toLowerCase(), clazz);
}
}
@@ -118,7 +124,7 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
HiveFuncHolder holder;
MajorType[] argTypes = new MajorType[call.args.size()];
ObjectInspector[] argOIs = new ObjectInspector[call.args.size()];
- for(int i=0; i<call.args.size(); i++) {
+ for (int i=0; i<call.args.size(); i++) {
try {
argTypes[i] = call.args.get(i).getMajorType();
if (convertVarCharToVar16Char && argTypes[i].getMinorType() == MinorType.VARCHAR) {
@@ -136,17 +142,19 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
String funcName = call.getName().toLowerCase();
// search in GenericUDF list
- for(Class<? extends GenericUDF> clazz: methodsGenericUDF.get(funcName)) {
+ for (Class<? extends GenericUDF> clazz: methodsGenericUDF.get(funcName)) {
holder = matchAndCreateGenericUDFHolder(clazz, argTypes, argOIs);
- if(holder != null)
+ if (holder != null) {
return holder;
+ }
}
// search in UDF list
for (Class<? extends UDF> clazz : methodsUDF.get(funcName)) {
holder = matchAndCreateUDFHolder(call.getName(), clazz, argTypes, argOIs);
- if (holder != null)
+ if (holder != null) {
return holder;
+ }
}
return null;
@@ -166,9 +174,9 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
returnOI,
Types.optional(ObjectInspectorHelper.getDrillType(returnOI)),
nonDeterministicUDFs.contains(udfClazz));
- } catch(IllegalAccessException | InstantiationException e) {
+ } catch (IllegalAccessException | InstantiationException e) {
logger.debug("Failed to instantiate class", e);
- } catch(Exception e) { /*ignore this*/ }
+ } catch (Exception e) { /*ignore this*/ }
return null;
}
@@ -188,8 +196,9 @@ public class HiveFunctionRegistry implements PluggableFunctionRegistry{
returnOI,
Types.optional(ObjectInspectorHelper.getDrillType(returnOI)),
nonDeterministicUDFs.contains(udfClazz));
- } catch(Exception e) { /*ignore this*/ }
+ } catch (Exception e) { /*ignore this*/ }
return null;
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
index 2c265d0..e07d11e 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveFieldConverter.java
@@ -83,8 +83,9 @@ public abstract class HiveFieldConverter {
case PRIMITIVE:
final PrimitiveCategory pCat = ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory();
Class< ? extends HiveFieldConverter> clazz = primMap.get(pCat);
- if (clazz != null)
+ if (clazz != null) {
return clazz.newInstance();
+ }
HiveRecordReader.throwUnsupportedHiveDataTypeError(pCat.toString());
break;
@@ -210,4 +211,5 @@ public abstract class HiveFieldConverter {
return ((NullableDateVector) outputVV).getMutator().setSafe(outputIndex, date.getMillis());
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveScan.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveScan.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveScan.java
index c9569f9..d7ef5bf 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveScan.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveScan.java
@@ -139,7 +139,7 @@ public class HiveScan extends AbstractGroupScan {
for (Object obj : properties.keySet()) {
job.set((String) obj, (String) properties.get(obj));
}
- for(Map.Entry<String, String> entry : hiveReadEntry.hiveConfigOverride.entrySet()) {
+ for (Map.Entry<String, String> entry : hiveReadEntry.hiveConfigOverride.entrySet()) {
job.set(entry.getKey(), entry.getValue());
}
InputFormat<?, ?> format = (InputFormat<?, ?>) Class.forName(table.getSd().getInputFormat()).getConstructor().newInstance();
@@ -218,7 +218,9 @@ public class HiveScan extends AbstractGroupScan {
encodedInputSplits.add(serializeInputSplit(split));
splitTypes.add(split.getClass().getName());
}
- if (parts.contains(null)) parts = null;
+ if (parts.contains(null)) {
+ parts = null;
+ }
HiveReadEntry subEntry = new HiveReadEntry(hiveReadEntry.table, parts, hiveReadEntry.hiveConfigOverride);
return new HiveSubScan(encodedInputSplits, subEntry, splitTypes, columns);
} catch (IOException | ReflectiveOperationException e) {
@@ -274,7 +276,7 @@ public class HiveScan extends AbstractGroupScan {
public ScanStats getScanStats() {
try {
long data =0;
- for(InputSplit split : inputSplits){
+ for (InputSplit split : inputSplits) {
data += split.getLength();
}
@@ -313,4 +315,5 @@ public class HiveScan extends AbstractGroupScan {
public boolean canPushdownProjects(List<SchemaPath> columns) {
return true;
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePluginConfig.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePluginConfig.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePluginConfig.java
index c01389f..38440aa 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePluginConfig.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveStoragePluginConfig.java
@@ -50,13 +50,20 @@ public class HiveStoragePluginConfig extends StoragePluginConfigBase {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
HiveStoragePluginConfig that = (HiveStoragePluginConfig) o;
- if (configProps != null ? !configProps.equals(that.configProps) : that.configProps != null) return false;
+ if (configProps != null ? !configProps.equals(that.configProps) : that.configProps != null) {
+ return false;
+ }
return true;
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTable.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTable.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTable.java
index 50c81e9..c219cfd 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTable.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTable.java
@@ -84,14 +84,18 @@ public class HiveTable {
this.tableType = tableType;
List<FieldSchema> partitionKeysUnwrapped = Lists.newArrayList();
- for (FieldSchemaWrapper w : partitionKeys) partitionKeysUnwrapped.add(w.getFieldSchema());
+ for (FieldSchemaWrapper w : partitionKeys) {
+ partitionKeysUnwrapped.add(w.getFieldSchema());
+ }
StorageDescriptor sdUnwrapped = sd.getSd();
this.table = new Table(tableName, dbName, owner, createTime, lastAccessTime, retention, sdUnwrapped, partitionKeysUnwrapped,
parameters, viewOriginalText, viewExpandedText, tableType);
}
public HiveTable(Table table) {
- if (table == null) return;
+ if (table == null) {
+ return;
+ }
this.table = table;
this.tableName = table.getTableName();
this.dbName = table.getDbName();
@@ -101,7 +105,9 @@ public class HiveTable {
this.retention = table.getRetention();
this.sd = new StorageDescriptorWrapper(table.getSd());
this.partitionKeys = Lists.newArrayList();
- for (FieldSchema f : table.getPartitionKeys()) this.partitionKeys.add(new FieldSchemaWrapper(f));
+ for (FieldSchema f : table.getPartitionKeys()) {
+ this.partitionKeys.add(new FieldSchemaWrapper(f));
+ }
this.parameters = table.getParameters();
this.viewOriginalText = table.getViewOriginalText();
this.viewExpandedText = table.getViewExpandedText();
@@ -151,7 +157,9 @@ public class HiveTable {
}
public HivePartition(Partition partition) {
- if (partition == null) return;
+ if (partition == null) {
+ return;
+ }
this.partition = partition;
this.values = partition.getValues();
this.tableName = partition.getTableName();
@@ -208,10 +216,14 @@ public class HiveTable {
this.sortCols = sortCols;
this.parameters = parameters;
List<FieldSchema> colsUnwrapped = Lists.newArrayList();
- for (FieldSchemaWrapper w: cols) colsUnwrapped.add(w.getFieldSchema());
+ for (FieldSchemaWrapper w: cols) {
+ colsUnwrapped.add(w.getFieldSchema());
+ }
SerDeInfo serDeInfoUnwrapped = serDeInfo.getSerDeInfo();
List<Order> sortColsUnwrapped = Lists.newArrayList();
- for (OrderWrapper w : sortCols) sortColsUnwrapped.add(w.getOrder());
+ for (OrderWrapper w : sortCols) {
+ sortColsUnwrapped.add(w.getOrder());
+ }
// this.sd = new StorageDescriptor(colsUnwrapped, location, inputFormat, outputFormat, compressed, numBuckets, serDeInfoUnwrapped,
// bucketCols, sortColsUnwrapped, parameters);
this.sd = new StorageDescriptor(colsUnwrapped, location, inputFormat, outputFormat, compressed, numBuckets, serDeInfoUnwrapped,
@@ -221,7 +233,9 @@ public class HiveTable {
public StorageDescriptorWrapper(StorageDescriptor sd) {
this.sd = sd;
this.cols = Lists.newArrayList();
- for (FieldSchema f : sd.getCols()) this.cols.add(new FieldSchemaWrapper(f));
+ for (FieldSchema f : sd.getCols()) {
+ this.cols.add(new FieldSchemaWrapper(f));
+ }
this.location = sd.getLocation();
this.inputFormat = sd.getInputFormat();
this.outputFormat = sd.getOutputFormat();
@@ -230,7 +244,9 @@ public class HiveTable {
this.serDeInfo = new SerDeInfoWrapper(sd.getSerdeInfo());
// this.bucketCols = sd.getBucketCols();
this.sortCols = Lists.newArrayList();
- for (Order o : sd.getSortCols()) this.sortCols.add(new OrderWrapper(o));
+ for (Order o : sd.getSortCols()) {
+ this.sortCols.add(new OrderWrapper(o));
+ }
this.parameters = sd.getParameters();
}
@@ -328,4 +344,5 @@ public class HiveTable {
return ord;
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
index 05ee59f..5406048 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveTextRecordReader.java
@@ -161,16 +161,21 @@ public class HiveTextRecordReader extends HiveRecordReader {
boolean success = false; // setValue(primitiveCategories.get(i), vectors.get(i), recordCount, bytes, delimPositions[id] + 1);
if (!success) {
redoRecord = value;
- if (partition != null) populatePartitionVectors(recordCount);
+ if (partition != null) {
+ populatePartitionVectors(recordCount);
+ }
return recordCount;
}
}
recordCount++;
}
- if (partition != null) populatePartitionVectors(recordCount);
+ if (partition != null) {
+ populatePartitionVectors(recordCount);
+ }
return recordCount;
} catch (IOException e) {
throw new DrillRuntimeException(e);
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java
index 6c0d44b..023517b 100644
--- a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java
+++ b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveSchemaFactory.java
@@ -118,8 +118,9 @@ public class HiveSchemaFactory implements SchemaFactory {
@Override
public List<String> load(String key) throws Exception {
- if (!DATABASES.equals(key))
+ if (!DATABASES.equals(key)) {
throw new UnsupportedOperationException();
+ }
try {
return mClient.getAllDatabases();
} catch (TException e) {
@@ -158,8 +159,9 @@ public class HiveSchemaFactory implements SchemaFactory {
t = mClient.getTable(dbName, key);
}
- if (t == null)
+ if (t == null) {
throw new UnknownTableException(String.format("Unable to find table '%s'.", key));
+ }
List<Partition> partitions = null;
try {
@@ -174,8 +176,9 @@ public class HiveSchemaFactory implements SchemaFactory {
hivePartitions.add(new HiveTable.HivePartition(part));
}
- if (hivePartitions.size() == 0)
+ if (hivePartitions.size() == 0) {
hivePartitions = null;
+ }
return new HiveReadEntry(new HiveTable(t), hivePartitions, hiveConfigOverride);
}
@@ -209,7 +212,7 @@ public class HiveSchemaFactory implements SchemaFactory {
}
tables = tableNameLoader.get(name);
HiveDatabaseSchema schema = new HiveDatabaseSchema(tables, this, name);
- if(name.equals("default")){
+ if (name.equals("default")) {
this.defaultSchema = schema;
}
return schema;
@@ -221,8 +224,8 @@ public class HiveSchemaFactory implements SchemaFactory {
}
- void setHolder(SchemaPlus plusOfThis){
- for(String s : getSubSchemaNames()){
+ void setHolder(SchemaPlus plusOfThis) {
+ for (String s : getSubSchemaNames()) {
plusOfThis.add(s, getSubSchema(s));
}
}
@@ -234,10 +237,10 @@ public class HiveSchemaFactory implements SchemaFactory {
@Override
public Set<String> getSubSchemaNames() {
- try{
+ try {
List<String> dbs = databases.get(DATABASES);
return Sets.newHashSet(dbs);
- }catch(ExecutionException e){
+ } catch (ExecutionException e) {
logger.warn("Failure while getting Hive database list.", e);
}
return super.getSubSchemaNames();
@@ -245,7 +248,7 @@ public class HiveSchemaFactory implements SchemaFactory {
@Override
public net.hydromatic.optiq.Table getTable(String name) {
- if(defaultSchema == null){
+ if (defaultSchema == null) {
return super.getTable(name);
}
return defaultSchema.getTable(name);
@@ -253,24 +256,26 @@ public class HiveSchemaFactory implements SchemaFactory {
@Override
public Set<String> getTableNames() {
- if(defaultSchema == null){
+ if (defaultSchema == null) {
return super.getTableNames();
}
return defaultSchema.getTableNames();
}
- List<String> getTableNames(String dbName){
+ List<String> getTableNames(String dbName) {
try{
return tableNameLoader.get(dbName);
- }catch(ExecutionException e){
+ } catch (ExecutionException e) {
logger.warn("Failure while loading table names for database '{}'.", dbName, e.getCause());
return Collections.emptyList();
}
}
- DrillTable getDrillTable(String dbName, String t){
+ DrillTable getDrillTable(String dbName, String t) {
HiveReadEntry entry = getSelectionBaseOnName(dbName, t);
- if(entry == null) return null;
+ if (entry == null) {
+ return null;
+ }
if (entry.getJdbcTableType() == TableType.VIEW) {
return new DrillHiveViewTable(schemaName, plugin, entry);
@@ -280,10 +285,12 @@ public class HiveSchemaFactory implements SchemaFactory {
}
HiveReadEntry getSelectionBaseOnName(String dbName, String t) {
- if(dbName == null) dbName = "default";
+ if (dbName == null) {
+ dbName = "default";
+ }
try{
return tableLoaders.get(dbName).get(t);
- }catch(ExecutionException e){
+ }catch(ExecutionException e) {
logger.warn("Exception occurred while trying to read table. {}.{}", dbName, t, e.getCause());
return null;
}
@@ -301,5 +308,4 @@ public class HiveSchemaFactory implements SchemaFactory {
}
-
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestHiveUDFs.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestHiveUDFs.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestHiveUDFs.java
index 24899d4..4a9be84 100644
--- a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestHiveUDFs.java
+++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/fn/hive/TestHiveUDFs.java
@@ -46,7 +46,7 @@ public class TestHiveUDFs extends BaseTestQuery {
List<QueryResultBatch> results = testPhysicalWithResults(planString);
RecordBatchLoader batchLoader = new RecordBatchLoader(getAllocator());
- for(QueryResultBatch result : results) {
+ for (QueryResultBatch result : results) {
batchLoader.load(result.getHeader().getDef(), result.getData());
if (batchLoader.getRecordCount() <= 0) {
result.release();
@@ -71,7 +71,7 @@ public class TestHiveUDFs extends BaseTestQuery {
NullableVar16CharVector nullableStr1V = (NullableVar16CharVector) batchLoader.getValueAccessorById(NullableVar16CharVector.class, 6).getValueVector();
NullableVar16CharVector upperNullableStr1V = (NullableVar16CharVector) batchLoader.getValueAccessorById(NullableVar16CharVector.class, 7).getValueVector();
- for(int i=0; i<batchLoader.getRecordCount(); i++) {
+ for (int i=0; i<batchLoader.getRecordCount(); i++) {
String in = new String(str1V.getAccessor().get(i), Charsets.UTF_16);
String upper = new String(upperStr1V.getAccessor().get(i), Charsets.UTF_16);
assertTrue(in.toUpperCase().equals(upper));
@@ -86,16 +86,19 @@ public class TestHiveUDFs extends BaseTestQuery {
String nullableStr1 = null;
- if (!nullableStr1V.getAccessor().isNull(i))
+ if (!nullableStr1V.getAccessor().isNull(i)) {
nullableStr1 = new String(nullableStr1V.getAccessor().get(i), Charsets.UTF_16);
+ }
String upperNullableStr1 = null;
- if (!upperNullableStr1V.getAccessor().isNull(i))
+ if (!upperNullableStr1V.getAccessor().isNull(i)) {
upperNullableStr1 = new String(upperNullableStr1V.getAccessor().get(i), Charsets.UTF_16);
+ }
assertEquals(nullableStr1 != null, upperNullableStr1 != null);
- if (nullableStr1 != null)
+ if (nullableStr1 != null) {
assertEquals(nullableStr1.toUpperCase(), upperNullableStr1);
+ }
System.out.println(in + ", " + upper + ", " + unix_timestamp + ", " + concat + ", " +
flt1 + ", " + format_number + ", " + nullableStr1 + ", " + upperNullableStr1);
@@ -117,7 +120,7 @@ public class TestHiveUDFs extends BaseTestQuery {
List<QueryResultBatch> results = testPhysicalWithResults(planString);
RecordBatchLoader batchLoader = new RecordBatchLoader(getAllocator());
- for(QueryResultBatch result : results) {
+ for (QueryResultBatch result : results) {
batchLoader.load(result.getHeader().getDef(), result.getData());
if (batchLoader.getRecordCount() <= 0) {
result.release();
@@ -137,7 +140,7 @@ public class TestHiveUDFs extends BaseTestQuery {
Float4Vector flt1V = (Float4Vector) batchLoader.getValueAccessorById(Float4Vector.class, 3).getValueVector();
NullableFloat8Vector powV = (NullableFloat8Vector) batchLoader.getValueAccessorById(NullableFloat8Vector.class, 4).getValueVector();
- for(int i=0; i<batchLoader.getRecordCount(); i++) {
+ for (int i=0; i<batchLoader.getRecordCount(); i++) {
String str1 = new String(str1V.getAccessor().get(i), Charsets.UTF_16);
int str1Length = str1LengthV.getAccessor().get(i);
assertTrue(str1.length() == str1Length);
@@ -162,4 +165,5 @@ public class TestHiveUDFs extends BaseTestQuery {
System.out.println("Processed " + numRecords + " records");
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java
index b618a93..7b2c9b6 100644
--- a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java
+++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java
@@ -51,7 +51,7 @@ public class HiveTestDataGenerator {
private void cleanDir(String dir) throws IOException{
File f = new File(dir);
- if(f.exists()){
+ if (f.exists()) {
FileUtils.cleanDirectory(f);
FileUtils.forceDelete(f);
}
@@ -236,8 +236,9 @@ public class HiveTestDataGenerator {
File file = getTempFile();
PrintWriter printWriter = new PrintWriter(file);
- for (int i=1; i<=5; i++)
+ for (int i=1; i<=5; i++) {
printWriter.println (String.format("%d, key_%d", i, i));
+ }
printWriter.close();
return file.getPath();
@@ -276,12 +277,15 @@ public class HiveTestDataGenerator {
try {
response = hiveDriver.run(query);
} catch(CommandNeedRetryException ex) {
- if (--retryCount == 0)
+ if (--retryCount == 0) {
failed = true;
+ }
}
- if (failed || response.getResponseCode() != 0 )
+ if (failed || response.getResponseCode() != 0 ) {
throw new RuntimeException(String.format("Failed to execute command '%s', errorMsg = '%s'",
query, (response != null ? response.getErrorMessage() : "")));
+ }
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/contrib/storage-hive/core/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/test/resources/logback.xml b/contrib/storage-hive/core/src/test/resources/logback.xml
index 385b80f..a9e1586 100644
--- a/contrib/storage-hive/core/src/test/resources/logback.xml
+++ b/contrib/storage-hive/core/src/test/resources/logback.xml
@@ -27,7 +27,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <!-- The property 'logback.log.dir' is defined in pom.xml -->
+ <!-- The property 'logback.log.dir' is defined in pom.xml -->
<file>${logback.log.dir:-./target/surefire-reports}/hive-tests-${bySecond}.log</file>
<append>false</append>
<encoder>
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/exec/java-exec/src/main/java/io/netty/buffer/DrillBuf.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/io/netty/buffer/DrillBuf.java b/exec/java-exec/src/main/java/io/netty/buffer/DrillBuf.java
index 5399239..2f9154d 100644
--- a/exec/java-exec/src/main/java/io/netty/buffer/DrillBuf.java
+++ b/exec/java-exec/src/main/java/io/netty/buffer/DrillBuf.java
@@ -62,7 +62,7 @@ public final class DrillBuf extends AbstractByteBuf {
this.emptyBuffer = false;
}
- private DrillBuf(ByteBuffer bb){
+ private DrillBuf(ByteBuffer bb) {
super(bb.remaining());
UnpooledUnsafeDirectByteBuf bytebuf = new UnpooledUnsafeDirectByteBuf(UnpooledByteBufAllocator.DEFAULT, bb, bb.remaining());
this.acct = FakeAllocator.FAKE_ACCOUNTOR;
@@ -76,7 +76,7 @@ public final class DrillBuf extends AbstractByteBuf {
this.writerIndex(bb.remaining());
}
- private DrillBuf(BufferAllocator allocator, Accountor a){
+ private DrillBuf(BufferAllocator allocator, Accountor a) {
super(0);
this.b = new EmptyByteBuf(allocator.getUnderlyingAllocator()).order(ByteOrder.LITTLE_ENDIAN);
this.allocator = allocator;
@@ -106,24 +106,26 @@ public final class DrillBuf extends AbstractByteBuf {
this.allocator = buffer.allocator;
}
- public void setOperatorContext(OperatorContext c){
+ public void setOperatorContext(OperatorContext c) {
this.context = c;
}
- public void setFragmentContext(FragmentContext c){
+ public void setFragmentContext(FragmentContext c) {
this.fContext = c;
}
- public BufferAllocator getAllocator(){
+ public BufferAllocator getAllocator() {
return allocator;
}
- public DrillBuf reallocIfNeeded(int size){
- if(this.capacity() >= size) return this;
- if(context != null){
+ public DrillBuf reallocIfNeeded(int size) {
+ if (this.capacity() >= size) {
+ return this;
+ }
+ if (context != null) {
return context.replace(this, size);
- }else if(fContext != null){
+ } else if(fContext != null) {
return fContext.replace(this, size);
- }else{
+ } else {
throw new UnsupportedOperationException("Realloc is only available in the context of an operator's UDFs");
}
@@ -138,25 +140,23 @@ public final class DrillBuf extends AbstractByteBuf {
return addr + index;
}
-
-
private final void checkIndexD(int index) {
- ensureAccessible();
- if (index < 0 || index >= capacity()) {
- throw new IndexOutOfBoundsException(String.format(
- "index: %d (expected: range(0, %d))", index, capacity()));
- }
+ ensureAccessible();
+ if (index < 0 || index >= capacity()) {
+ throw new IndexOutOfBoundsException(String.format(
+ "index: %d (expected: range(0, %d))", index, capacity()));
+ }
}
private final void checkIndexD(int index, int fieldLength) {
- ensureAccessible();
- if (fieldLength < 0) {
- throw new IllegalArgumentException("length: " + fieldLength + " (expected: >= 0)");
- }
- if (index < 0 || index > capacity() - fieldLength) {
- throw new IndexOutOfBoundsException(String.format(
- "index: %d, length: %d (expected: range(0, %d))", index, fieldLength, capacity()));
- }
+ ensureAccessible();
+ if (fieldLength < 0) {
+ throw new IllegalArgumentException("length: " + fieldLength + " (expected: >= 0)");
+ }
+ if (index < 0 || index > capacity() - fieldLength) {
+ throw new IndexOutOfBoundsException(String.format(
+ "index: %d, length: %d (expected: range(0, %d))", index, fieldLength, capacity()));
+ }
}
private void chk(int index, int width) {
@@ -210,7 +210,6 @@ public final class DrillBuf extends AbstractByteBuf {
return length;
}
-
@Override
public synchronized ByteBuf capacity(int newCapacity) {
if (rootBuffer) {
@@ -363,20 +362,20 @@ public final class DrillBuf extends AbstractByteBuf {
@Override
public String toString(int index, int length, Charset charset) {
- if (length == 0) {
- return "";
- }
+ if (length == 0) {
+ return "";
+ }
- ByteBuffer nioBuffer;
- if (nioBufferCount() == 1) {
- nioBuffer = nioBuffer(index, length);
- } else {
- nioBuffer = ByteBuffer.allocate(length);
- getBytes(index, nioBuffer);
- nioBuffer.flip();
- }
+ ByteBuffer nioBuffer;
+ if (nioBufferCount() == 1) {
+ nioBuffer = nioBuffer(index, length);
+ } else {
+ nioBuffer = ByteBuffer.allocate(length);
+ getBytes(index, nioBuffer);
+ nioBuffer.flip();
+ }
- return ByteBufUtil.decodeString(nioBuffer, charset);
+ return ByteBufUtil.decodeString(nioBuffer, charset);
}
@Override
@@ -615,10 +614,10 @@ public final class DrillBuf extends AbstractByteBuf {
@Override
protected int _getUnsignedMedium(int index) {
- long addr = addr(index);
- return (PlatformDependent.getByte(addr) & 0xff) << 16 |
- (PlatformDependent.getByte(addr + 1) & 0xff) << 8 |
- PlatformDependent.getByte(addr + 2) & 0xff;
+ long addr = addr(index);
+ return (PlatformDependent.getByte(addr) & 0xff) << 16 |
+ (PlatformDependent.getByte(addr + 1) & 0xff) << 8 |
+ PlatformDependent.getByte(addr + 2) & 0xff;
}
@Override
@@ -659,20 +658,21 @@ public final class DrillBuf extends AbstractByteBuf {
return PlatformDependent.getByte(addr(index));
}
- public static DrillBuf getEmpty(BufferAllocator allocator, Accountor a){
+ public static DrillBuf getEmpty(BufferAllocator allocator, Accountor a) {
return new DrillBuf(allocator, a);
}
- public boolean isRootBuffer(){
+ public boolean isRootBuffer() {
return rootBuffer;
}
- public static DrillBuf wrapByteBuffer(ByteBuffer b){
- if(!b.isDirect()){
+ public static DrillBuf wrapByteBuffer(ByteBuffer b) {
+ if (!b.isDirect()) {
throw new IllegalStateException("DrillBufs can only refer to direct memory.");
- }else{
+ } else {
return new DrillBuf(b);
}
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/exec/java-exec/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java
----------------------------------------------------------------------
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 2cca5d7..dfdc114 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
@@ -29,7 +29,9 @@ public final class UnsafeDirectLittleEndian extends WrappedByteBuf {
UnsafeDirectLittleEndian(PooledUnsafeDirectByteBuf buf) {
super(buf);
- if(!NATIVE_ORDER || buf.order() != ByteOrder.BIG_ENDIAN) throw new IllegalStateException("Drill only runs on LittleEndian systems.");
+ if (!NATIVE_ORDER || buf.order() != ByteOrder.BIG_ENDIAN) {
+ throw new IllegalStateException("Drill only runs on LittleEndian systems.");
+ }
wrapped = buf;
this.memoryAddress = buf.memoryAddress();
}
@@ -188,6 +190,4 @@ public final class UnsafeDirectLittleEndian extends WrappedByteBuf {
return this;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/exec/java-exec/src/main/java/org/apache/drill/exec/cache/CachedVectorContainer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/CachedVectorContainer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/CachedVectorContainer.java
index da0b186..ff6c14b 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/CachedVectorContainer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/CachedVectorContainer.java
@@ -86,11 +86,13 @@ public class CachedVectorContainer extends LoopedAbstractDrillSerializable {
}
public void clear() {
- if(container != null) container.clear();
+ if (container != null) {
+ container.clear();
+ }
container = null;
}
- public byte[] getData(){
+ public byte[] getData() {
return data;
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/676f5df6/exec/java-exec/src/main/java/org/apache/drill/exec/cache/DistributedCache.java
----------------------------------------------------------------------
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 1e0c985..019f9ee 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
@@ -21,7 +21,6 @@ import org.apache.drill.exec.exception.DrillbitStartupException;
import com.google.protobuf.Message;
-
public interface DistributedCache extends AutoCloseable{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DistributedCache.class);
@@ -38,13 +37,15 @@ public interface DistributedCache extends AutoCloseable{
PROTOBUF(String.class, Message.class);
private final Class<?>[] classes;
- private SerializationMode(Class<?>... classes){
+ private SerializationMode(Class<?>... classes) {
this.classes = classes;
}
- public void checkClass(Class<?> classToCheck){
- for(Class<?> c : classes){
- if(c.isAssignableFrom(classToCheck)) return;
+ public void checkClass(Class<?> classToCheck) {
+ for(Class<?> c : classes) {
+ if(c.isAssignableFrom(classToCheck)) {
+ return;
+ }
}
throw new UnsupportedOperationException(String.format("You are trying to serialize the class %s using the serialization mode %s. This is not allowed.", classToCheck.getName(), this.name()));
@@ -102,34 +103,43 @@ public interface DistributedCache extends AutoCloseable{
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
CacheConfig other = (CacheConfig) obj;
if (keyClass == null) {
- if (other.keyClass != null)
+ if (other.keyClass != null) {
return false;
- } else if (!keyClass.equals(other.keyClass))
+ }
+ } else if (!keyClass.equals(other.keyClass)) {
return false;
- if (mode != other.mode)
+ }
+ if (mode != other.mode) {
return false;
+ }
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
if (valueClass == null) {
- if (other.valueClass != null)
+ if (other.valueClass != null) {
return false;
- } else if (!valueClass.equals(other.valueClass))
+ }
+ } else if (!valueClass.equals(other.valueClass)) {
return false;
+ }
return true;
}
-
}
public static class CacheConfigBuilder<K, V> {
@@ -145,40 +155,38 @@ public interface DistributedCache extends AutoCloseable{
this.name = keyClass.getName();
}
-
- public CacheConfigBuilder<K, V> mode(SerializationMode mode){
+ public CacheConfigBuilder<K, V> mode(SerializationMode mode) {
this.mode = mode;
return this;
}
- public CacheConfigBuilder<K, V> proto(){
+ public CacheConfigBuilder<K, V> proto() {
this.mode = SerializationMode.PROTOBUF;
return this;
}
- public CacheConfigBuilder<K, V> jackson(){
+ public CacheConfigBuilder<K, V> jackson() {
this.mode = SerializationMode.JACKSON;
return this;
}
- public CacheConfigBuilder<K, V> drill(){
+ public CacheConfigBuilder<K, V> drill() {
this.mode = SerializationMode.DRILL_SERIALIZIABLE;
return this;
}
- public CacheConfigBuilder<K, V> name(String name){
+ public CacheConfigBuilder<K, V> name(String name) {
this.name = name;
return this;
}
- public CacheConfig<K, V> build(){
+ public CacheConfig<K, V> build() {
mode.checkClass(keyClass);
mode.checkClass(valueClass);
return new CacheConfig<K, V>(keyClass, valueClass, name, mode);
}
-
-
}
+
}