kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [11/67] [abbrv] kylin git commit: Revert "reformat code"
Date Mon, 05 Jun 2017 05:22:59 GMT
http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/AggregateMultipleExpandRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/AggregateMultipleExpandRule.java b/query/src/main/java/org/apache/kylin/query/optrule/AggregateMultipleExpandRule.java
index 582a434..cdd6004 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/AggregateMultipleExpandRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/AggregateMultipleExpandRule.java
@@ -18,12 +18,8 @@
 
 package org.apache.kylin.query.optrule;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.plan.RelOptRuleOperand;
@@ -37,8 +33,10 @@ import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.tools.RelBuilder;
 import org.apache.calcite.util.ImmutableBitSet;
 
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * Supoort grouping query. Expand the non-simple aggregate to more than one simple aggregates.
@@ -85,8 +83,7 @@ public class AggregateMultipleExpandRule extends RelOptRule {
 
         for (ImmutableBitSet groupSet : aggr.getGroupSets()) {
             // push the simple aggregate with one group set
-            relBuilder.push(
-                    aggr.copy(aggr.getTraitSet(), input, false, groupSet, asList(groupSet), aggr.getAggCallList()));
+            relBuilder.push(aggr.copy(aggr.getTraitSet(), input, false, groupSet, asList(groupSet), aggr.getAggCallList()));
 
             ImmutableList.Builder<RexNode> rexNodes = new ImmutableList.Builder<>();
             int index = 0;

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/AggregateProjectReduceRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/AggregateProjectReduceRule.java b/query/src/main/java/org/apache/kylin/query/optrule/AggregateProjectReduceRule.java
index a411ec2..f6ac61a 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/AggregateProjectReduceRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/AggregateProjectReduceRule.java
@@ -36,9 +36,9 @@ import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.tools.RelBuilder;
 import org.apache.calcite.tools.RelBuilderFactory;
 import org.apache.calcite.util.ImmutableBitSet;
-import org.apache.calcite.util.Pair;
 
 import com.google.common.collect.ImmutableList;
+import org.apache.calcite.util.Pair;
 
 /**
  * Reduce project under aggregate which has unused input ref.
@@ -55,8 +55,7 @@ public class AggregateProjectReduceRule extends RelOptRule {
         super(operand, factory, description);
     }
 
-    private void mappingKeys(int key, Pair<RexNode, String> project, List<Pair<RexNode, String>> projects,
-            Map<Integer, Integer> mapping) {
+    private void mappingKeys(int key, Pair<RexNode, String> project, List<Pair<RexNode, String>> projects, Map<Integer, Integer> mapping) {
         if (!projects.contains(project)) {
             projects.add(project);
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPAggregateRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPAggregateRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPAggregateRule.java
index c76fb9b..da53152 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPAggregateRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPAggregateRule.java
@@ -52,8 +52,7 @@ public class OLAPAggregateRule extends ConverterRule {
 
         RelTraitSet traitSet = agg.getTraitSet().replace(OLAPRel.CONVENTION);
         try {
-            return new OLAPAggregateRel(agg.getCluster(), traitSet, convert(agg.getInput(), traitSet), agg.indicator,
-                    agg.getGroupSet(), agg.getGroupSets(), agg.getAggCallList());
+            return new OLAPAggregateRel(agg.getCluster(), traitSet, convert(agg.getInput(), traitSet), agg.indicator, agg.getGroupSet(), agg.getGroupSets(), agg.getAggCallList());
         } catch (InvalidRelException e) {
             throw new IllegalStateException("Can't create OLAPAggregateRel!", e);
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPFilterRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPFilterRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPFilterRule.java
index 3f07f48..33f3ea8 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPFilterRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPFilterRule.java
@@ -42,8 +42,7 @@ public class OLAPFilterRule extends RelOptRule {
         RelTraitSet origTraitSet = filter.getTraitSet();
         RelTraitSet traitSet = origTraitSet.replace(OLAPRel.CONVENTION).simplify();
 
-        OLAPFilterRel olapFilter = new OLAPFilterRel(filter.getCluster(), traitSet,
-                convert(filter.getInput(), traitSet), filter.getCondition());
+        OLAPFilterRel olapFilter = new OLAPFilterRel(filter.getCluster(), traitSet, convert(filter.getInput(), traitSet), filter.getCondition());
         call.transformTo(olapFilter);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPJoinRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPJoinRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPJoinRule.java
index a006eb0..c31d1d0 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPJoinRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPJoinRule.java
@@ -71,8 +71,7 @@ public class OLAPJoinRule extends ConverterRule {
             // return null;
         }
         if (!info.isEqui()) {
-            newRel = new OLAPFilterRel(cluster, newRel.getTraitSet(), newRel,
-                    info.getRemaining(cluster.getRexBuilder()));
+            newRel = new OLAPFilterRel(cluster, newRel.getTraitSet(), newRel, info.getRemaining(cluster.getRexBuilder()));
         }
         return newRel;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPSortRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPSortRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPSortRule.java
index f85b190..c020d63 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPSortRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPSortRule.java
@@ -44,9 +44,7 @@ public class OLAPSortRule extends ConverterRule {
         }
         final RelTraitSet traitSet = sort.getTraitSet().replace(OLAPRel.CONVENTION);
         final RelNode input = sort.getInput();
-        return new OLAPSortRel(rel.getCluster(), traitSet,
-                convert(input, input.getTraitSet().replace(OLAPRel.CONVENTION)), sort.getCollation(), sort.offset,
-                sort.fetch);
+        return new OLAPSortRel(rel.getCluster(), traitSet, convert(input, input.getTraitSet().replace(OLAPRel.CONVENTION)), sort.getCollation(), sort.offset, sort.fetch);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPUnionRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPUnionRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPUnionRule.java
index 5e2bf15..e3bc7a9 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPUnionRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPUnionRule.java
@@ -18,8 +18,6 @@
 
 package org.apache.kylin.query.optrule;
 
-import java.util.List;
-
 import org.apache.calcite.plan.Convention;
 import org.apache.calcite.plan.RelTraitSet;
 import org.apache.calcite.rel.RelNode;
@@ -28,6 +26,8 @@ import org.apache.calcite.rel.core.Union;
 import org.apache.kylin.query.relnode.OLAPRel;
 import org.apache.kylin.query.relnode.OLAPUnionRel;
 
+import java.util.List;
+
 /**
  */
 public class OLAPUnionRule extends ConverterRule {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/optrule/OLAPWindowRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/optrule/OLAPWindowRule.java b/query/src/main/java/org/apache/kylin/query/optrule/OLAPWindowRule.java
index ef9de56..74d1b10 100644
--- a/query/src/main/java/org/apache/kylin/query/optrule/OLAPWindowRule.java
+++ b/query/src/main/java/org/apache/kylin/query/optrule/OLAPWindowRule.java
@@ -41,7 +41,6 @@ public class OLAPWindowRule extends ConverterRule {
         final Window window = (Window) rel;
         final RelTraitSet traitSet = window.getTraitSet().replace(OLAPRel.CONVENTION);
         final RelNode input = window.getInput();
-        return new OLAPWindowRel(rel.getCluster(), traitSet, convert(input, OLAPRel.CONVENTION), window.constants,
-                window.getRowType(), window.groups);
+        return new OLAPWindowRel(rel.getCluster(), traitSet, convert(input, OLAPRel.CONVENTION), window.constants, window.getRowType(), window.groups);
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java
index 2485915..adb145a 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java
@@ -91,8 +91,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
         Map<String, Class<?>> udafs = MeasureTypeFactory.getUDAFs();
         for (String func : udafs.keySet()) {
             try {
-                AGGR_FUNC_PARAM_AS_MEASTURE_MAP.put(func,
-                        ((ParamAsMeasureCount) (udafs.get(func).newInstance())).getParamAsMeasureCount());
+                AGGR_FUNC_PARAM_AS_MEASTURE_MAP.put(func, ((ParamAsMeasureCount) (udafs.get(func).newInstance())).getParamAsMeasureCount());
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -123,9 +122,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
     private List<TblColRef> groups;
     private List<FunctionDesc> aggregations;
 
-    public OLAPAggregateRel(RelOptCluster cluster, RelTraitSet traits, RelNode child, boolean indicator,
-            ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls)
-            throws InvalidRelException {
+    public OLAPAggregateRel(RelOptCluster cluster, RelTraitSet traits, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) throws InvalidRelException {
         super(cluster, traits, child, indicator, groupSet, groupSets, aggCalls);
         Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
         this.afterAggregate = false;
@@ -134,8 +131,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
     }
 
     @Override
-    public Aggregate copy(RelTraitSet traitSet, RelNode input, boolean indicator, ImmutableBitSet groupSet,
-            List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) {
+    public Aggregate copy(RelTraitSet traitSet, RelNode input, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) {
         try {
             return new OLAPAggregateRel(getCluster(), traitSet, input, indicator, groupSet, groupSets, aggCalls);
         } catch (InvalidRelException e) {
@@ -153,8 +149,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
         if (getGroupType() == Group.SIMPLE) {
             cost = super.computeSelfCost(planner, mq).multiplyBy(.05);
         } else {
-            cost = super.computeSelfCost(planner, mq).multiplyBy(.05).plus(planner.getCost(getInput(), mq))
-                    .multiplyBy(groupSets.size() * 1.5);
+            cost = super.computeSelfCost(planner, mq).multiplyBy(.05).plus(planner.getCost(getInput(), mq)).multiplyBy(groupSets.size() * 1.5);
         }
         return cost;
     }
@@ -172,8 +167,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
         if (!this.afterAggregate) {
             addToContextGroupBy(this.groups);
             this.context.aggregations.addAll(this.aggregations);
-            this.context.aggrOutCols
-                    .addAll(columnRowType.getAllColumns().subList(groups.size(), columnRowType.getAllColumns().size()));
+            this.context.aggrOutCols.addAll(columnRowType.getAllColumns().subList(groups.size(), columnRowType.getAllColumns().size()));
             this.context.afterAggregate = true;
 
             if (this.context.afterLimit) {
@@ -221,8 +215,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
             } else {
                 AggregateCall aggCall = this.rewriteAggCalls.get(i);
                 int index = aggCall.getArgList().get(0);
-                aggOutName = getSqlFuncName(aggCall) + "_"
-                        + inputColumnRowType.getColumnByIndex(index).getIdentity().replace('.', '_') + "_";
+                aggOutName = getSqlFuncName(aggCall) + "_" + inputColumnRowType.getColumnByIndex(index).getIdentity().replace('.', '_') + "_";
             }
             TblColRef aggOutCol = TblColRef.newInnerColumn(aggOutName, TblColRef.InnerDataTypeEnum.LITERAL);
             aggOutCol.getColumnDesc().setId("" + (i + 1)); // mark the index of aggregation
@@ -365,8 +358,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
 
             if (aggFunc.needRewriteField()) {
                 String rewriteFieldName = aggFunc.getRewriteFieldName();
-                RelDataType rewriteFieldType = OLAPTable.createSqlType(typeFactory, aggFunc.getRewriteFieldType(),
-                        true);
+                RelDataType rewriteFieldType = OLAPTable.createSqlType(typeFactory, aggFunc.getRewriteFieldType(), true);
                 this.context.rewriteFields.put(rewriteFieldName, rewriteFieldType);
 
                 TblColRef column = buildRewriteColumn(aggFunc);
@@ -460,8 +452,7 @@ public class OLAPAggregateRel extends Aggregate implements OLAPRel {
             argTypes.add(type);
             typeFamilies.add(Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
         }
-        return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType),
-                InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction);
+        return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType), InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPContext.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPContext.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPContext.java
index f232813..31ed075 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPContext.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPContext.java
@@ -175,7 +175,7 @@ public class OLAPContext {
                 return true;
             }
         }
-
+        
         return false;
     }
 
@@ -207,8 +207,7 @@ public class OLAPContext {
         * @realization the cube used in this query
         * @OLAPInsufficientException no rights exception
         */
-        public TupleFilter check(OLAPAuthentication olapAuthentication, Collection<TblColRef> columns,
-                IRealization realization) throws IllegalArgumentException;
+        public TupleFilter check(OLAPAuthentication olapAuthentication, Collection<TblColRef> columns, IRealization realization) throws IllegalArgumentException;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
index 6609b63..8f86ae0 100755
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
@@ -206,7 +206,7 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
 
             Preconditions.checkNotNull(left);
             Preconditions.checkNotNull(right);
-
+            
             switch (call.op.getKind()) {
             case PLUS:
                 return new ConstantTupleFilter(left.add(right).toString());
@@ -228,8 +228,7 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
 
             ConstantTupleFilter constFilter = (ConstantTupleFilter) filter;
 
-            if (type.getFamily() == SqlTypeFamily.DATE || type.getFamily() == SqlTypeFamily.DATETIME
-                    || type.getFamily() == SqlTypeFamily.TIMESTAMP) {
+            if (type.getFamily() == SqlTypeFamily.DATE || type.getFamily() == SqlTypeFamily.DATETIME || type.getFamily() == SqlTypeFamily.TIMESTAMP) {
                 List<String> newValues = Lists.newArrayList();
                 for (Object v : constFilter.getValues()) {
                     if (v == null)
@@ -357,7 +356,7 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
             translateFilter(context);
         } else {
             context.afterHavingClauseFilter = true;
-
+            
             TupleFilterVisitor visitor = new TupleFilterVisitor(this.columnRowType);
             TupleFilter havingFilter = this.condition.accept(visitor);
             if (context.havingFilter == null)
@@ -378,10 +377,10 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
 
         TupleFilterVisitor visitor = new TupleFilterVisitor(this.columnRowType);
         TupleFilter filter = this.condition.accept(visitor);
-
+        
         // optimize the filter, the optimization has to be segment-irrelevant
         filter = new FilterOptimizeTransformer().transform(filter);
-
+        
         Set<TblColRef> filterColumns = Sets.newHashSet();
         TupleFilter.collectColumns(filter, filterColumns);
         for (TblColRef tblColRef : filterColumns) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
index 56449db..a27cf76 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
@@ -90,8 +90,7 @@ public class OLAPJoinRel extends EnumerableJoin implements OLAPRel {
         final JoinInfo joinInfo = JoinInfo.of(left, right, condition);
         assert joinInfo.isEqui();
         try {
-            return new OLAPJoinRel(getCluster(), traitSet, left, right, condition, joinInfo.leftKeys,
-                    joinInfo.rightKeys, variablesSet, joinType);
+            return new OLAPJoinRel(getCluster(), traitSet, left, right, condition, joinInfo.leftKeys, joinInfo.rightKeys, variablesSet, joinType);
         } catch (InvalidRelException e) {
             // Semantic error not possible. Must be a bug. Convert to internal error.
             throw new AssertionError(e);
@@ -179,8 +178,7 @@ public class OLAPJoinRel extends EnumerableJoin implements OLAPRel {
             JoinDesc join = buildJoin(condition);
 
             JoinRelType joinRelType = this.getJoinType();
-            String joinType = joinRelType == JoinRelType.INNER ? "INNER"
-                    : joinRelType == JoinRelType.LEFT ? "LEFT" : null;
+            String joinType = joinRelType == JoinRelType.INNER ? "INNER" : joinRelType == JoinRelType.LEFT ? "LEFT" : null;
             join.setType(joinType);
 
             this.context.joins.add(join);
@@ -211,8 +209,7 @@ public class OLAPJoinRel extends EnumerableJoin implements OLAPRel {
         columns.addAll(rightColumnRowType.getAllColumns());
 
         if (columns.size() != this.rowType.getFieldCount()) {
-            throw new IllegalStateException(
-                    "RowType=" + this.rowType.getFieldCount() + ", ColumnRowType=" + columns.size());
+            throw new IllegalStateException("RowType=" + this.rowType.getFieldCount() + ", ColumnRowType=" + columns.size());
         }
         return new ColumnRowType(columns);
     }
@@ -310,8 +307,7 @@ public class OLAPJoinRel extends EnumerableJoin implements OLAPRel {
 
         PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), pref.preferArray());
         RelOptTable factTable = context.firstTableScan.getTable();
-        MethodCallExpression exprCall = Expressions.call(factTable.getExpression(OLAPTable.class), "executeOLAPQuery",
-                implementor.getRootExpression(), Expressions.constant(context.id));
+        MethodCallExpression exprCall = Expressions.call(factTable.getExpression(OLAPTable.class), "executeOLAPQuery", implementor.getRootExpression(), Expressions.constant(context.id));
         return implementor.result(physType, Blocks.toBlock(exprCall));
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java
index 1388d10..2a248cc 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPLimitRel.java
@@ -66,8 +66,7 @@ public class OLAPLimitRel extends SingleRel implements OLAPRel {
 
     @Override
     public RelWriter explainTerms(RelWriter pw) {
-        return super.explainTerms(pw).itemIf("offset", localOffset, localOffset != null).itemIf("fetch", localFetch,
-                localFetch != null);
+        return super.explainTerms(pw).itemIf("offset", localOffset, localOffset != null).itemIf("fetch", localFetch, localFetch != null);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPProjectRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPProjectRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPProjectRel.java
index 258aa37..e7b09a3 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPProjectRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPProjectRel.java
@@ -72,8 +72,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
     private boolean afterAggregate;
     private boolean isMerelyPermutation = false;//project additionally added by OLAPJoinPushThroughJoinRule
 
-    public OLAPProjectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, List<RexNode> exps,
-            RelDataType rowType) {
+    public OLAPProjectRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, List<RexNode> exps, RelDataType rowType) {
         super(cluster, traitSet, child, exps, rowType);
         Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
         Preconditions.checkArgument(child.getConvention() == OLAPRel.CONVENTION);
@@ -103,8 +102,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
     @Override
     public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
         boolean hasRexOver = RexOver.containsOver(getProjects(), null);
-        return super.computeSelfCost(planner, mq).multiplyBy(.05)
-                .multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1));
+        return super.computeSelfCost(planner, mq).multiplyBy(.05).multiplyBy(getProjects().size() * (hasRexOver ? 50 : 1));
     }
 
     @Override
@@ -148,8 +146,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
         return new ColumnRowType(columns, sourceColumns);
     }
 
-    private TblColRef translateRexNode(RexNode rexNode, ColumnRowType inputColumnRowType, String fieldName,
-            Set<TblColRef> sourceCollector) {
+    private TblColRef translateRexNode(RexNode rexNode, ColumnRowType inputColumnRowType, String fieldName, Set<TblColRef> sourceCollector) {
         TblColRef column = null;
         if (rexNode instanceof RexInputRef) {
             RexInputRef inputRef = (RexInputRef) rexNode;
@@ -166,15 +163,13 @@ public class OLAPProjectRel extends Project implements OLAPRel {
         return column;
     }
 
-    private TblColRef translateFirstRexInputRef(RexCall call, ColumnRowType inputColumnRowType, String fieldName,
-            Set<TblColRef> sourceCollector) {
+    private TblColRef translateFirstRexInputRef(RexCall call, ColumnRowType inputColumnRowType, String fieldName, Set<TblColRef> sourceCollector) {
         for (RexNode operand : call.getOperands()) {
             if (operand instanceof RexInputRef) {
                 return translateRexInputRef((RexInputRef) operand, inputColumnRowType, fieldName, sourceCollector);
             }
             if (operand instanceof RexCall) {
-                TblColRef r = translateFirstRexInputRef((RexCall) operand, inputColumnRowType, fieldName,
-                        sourceCollector);
+                TblColRef r = translateFirstRexInputRef((RexCall) operand, inputColumnRowType, fieldName, sourceCollector);
                 if (r != null)
                     return r;
             }
@@ -182,14 +177,12 @@ public class OLAPProjectRel extends Project implements OLAPRel {
         return null;
     }
 
-    private TblColRef translateRexInputRef(RexInputRef inputRef, ColumnRowType inputColumnRowType, String fieldName,
-            Set<TblColRef> sourceCollector) {
+    private TblColRef translateRexInputRef(RexInputRef inputRef, ColumnRowType inputColumnRowType, String fieldName, Set<TblColRef> sourceCollector) {
         int index = inputRef.getIndex();
         // check it for rewrite count
         if (index < inputColumnRowType.size()) {
             TblColRef column = inputColumnRowType.getColumnByIndex(index);
-            if (!column.isInnerColumn() && context.belongToContextTables(column) && !this.rewriting
-                    && !this.afterAggregate) {
+            if (!column.isInnerColumn() && context.belongToContextTables(column) && !this.rewriting && !this.afterAggregate) {
                 if (!isMerelyPermutation) {
                     context.allColumns.add(column);
                 }
@@ -197,8 +190,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
             }
             return column;
         } else {
-            throw new IllegalStateException("Can't find " + inputRef + " from child columnrowtype " + inputColumnRowType
-                    + " with fieldname " + fieldName);
+            throw new IllegalStateException("Can't find " + inputRef + " from child columnrowtype " + inputColumnRowType + " with fieldname " + fieldName);
         }
     }
 
@@ -211,8 +203,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
 
     }
 
-    private TblColRef translateRexCall(RexCall call, ColumnRowType inputColumnRowType, String fieldName,
-            Set<TblColRef> sourceCollector) {
+    private TblColRef translateRexCall(RexCall call, ColumnRowType inputColumnRowType, String fieldName, Set<TblColRef> sourceCollector) {
         SqlOperator operator = call.getOperator();
         if (operator == SqlStdOperatorTable.EXTRACT_DATE) {
             return translateFirstRexInputRef(call, inputColumnRowType, fieldName, sourceCollector);
@@ -275,8 +266,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
             return true;
         }
 
-        if (rexNode instanceof RexCall && SqlKind.CAST.equals(rexNode.getKind())
-                && ((RexCall) rexNode).getOperands().get(0) instanceof RexLiteral) {
+        if (rexNode instanceof RexCall && SqlKind.CAST.equals(rexNode.getKind()) && ((RexCall) rexNode).getOperands().get(0) instanceof RexLiteral) {
             return true;
         }
 
@@ -289,15 +279,13 @@ public class OLAPProjectRel extends Project implements OLAPRel {
             // merge project & filter
             OLAPFilterRel filter = (OLAPFilterRel) getInput();
             RelNode inputOfFilter = inputs.get(0).getInput(0);
-            RexProgram program = RexProgram.create(inputOfFilter.getRowType(), this.rewriteProjects,
-                    filter.getCondition(), this.rowType, getCluster().getRexBuilder());
+            RexProgram program = RexProgram.create(inputOfFilter.getRowType(), this.rewriteProjects, filter.getCondition(), this.rowType, getCluster().getRexBuilder());
             return new EnumerableCalc(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE), //
                     inputOfFilter, program);
         } else {
             // keep project for table scan
             EnumerableRel input = sole(inputs);
-            RexProgram program = RexProgram.create(input.getRowType(), this.rewriteProjects, null, this.rowType,
-                    getCluster().getRexBuilder());
+            RexProgram program = RexProgram.create(input.getRowType(), this.rewriteProjects, null, this.rowType, getCluster().getRexBuilder());
             return new EnumerableCalc(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE), //
                     input, program);
         }
@@ -315,8 +303,7 @@ public class OLAPProjectRel extends Project implements OLAPRel {
         this.rewriting = true;
 
         // project before join or is just after OLAPToEnumerableConverter
-        if (!RewriteImplementor.needRewrite(this.context) || (this.hasJoin && !this.afterJoin) || this.afterAggregate
-                || !(this.context.hasPrecalculatedFields())) {
+        if (!RewriteImplementor.needRewrite(this.context) || (this.hasJoin && !this.afterJoin) || this.afterAggregate || !(this.context.hasPrecalculatedFields())) {
             this.columnRowType = this.buildColumnRowType();
             return;
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPRel.java
index 4ed84c2..814b0fd 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPRel.java
@@ -215,9 +215,8 @@ public interface OLAPRel extends RelNode {
         }
 
         @Override
-        public EnumerableRel.Result visitChild(EnumerableRel parent, int ordinal, EnumerableRel child,
-                EnumerableRel.Prefer prefer) {
-
+        public EnumerableRel.Result visitChild(EnumerableRel parent, int ordinal, EnumerableRel child, EnumerableRel.Prefer prefer) {
+            
             if (calciteDebug) {
                 OLAPContext context;
                 if (child instanceof OLAPRel)

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPSortRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPSortRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPSortRel.java
index d24c91e..03ba9c5 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPSortRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPSortRel.java
@@ -47,16 +47,14 @@ public class OLAPSortRel extends Sort implements OLAPRel {
     private ColumnRowType columnRowType;
     private OLAPContext context;
 
-    public OLAPSortRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation,
-            RexNode offset, RexNode fetch) {
+    public OLAPSortRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RelCollation collation, RexNode offset, RexNode fetch) {
         super(cluster, traitSet, child, collation, offset, fetch);
         Preconditions.checkArgument(getConvention() == OLAPRel.CONVENTION);
         Preconditions.checkArgument(getConvention() == child.getConvention());
     }
 
     @Override
-    public OLAPSortRel copy(RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, RexNode offset,
-            RexNode fetch) {
+    public OLAPSortRel copy(RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, RexNode offset, RexNode fetch) {
         return new OLAPSortRel(getCluster(), traitSet, newInput, newCollation, offset, fetch);
     }
 
@@ -122,8 +120,7 @@ public class OLAPSortRel extends Sort implements OLAPRel {
 
     @Override
     public EnumerableRel implementEnumerable(List<EnumerableRel> inputs) {
-        return new EnumerableSort(getCluster(),
-                getCluster().traitSetOf(EnumerableConvention.INSTANCE).replace(collation), //
+        return new EnumerableSort(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE).replace(collation), //
                 sole(inputs), collation, offset, fetch);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
index ddb9ebf..b583291 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
@@ -210,8 +210,7 @@ public class OLAPTableScan extends TableScan implements OLAPRel, EnumerableRel {
         Preconditions.checkState(columnRowType == null, "OLAPTableScan MUST NOT be shared by more than one prent");
 
         // create context in case of non-join
-        if (implementor.getContext() == null || !(implementor.getParentNode() instanceof OLAPJoinRel)
-                || implementor.isNewOLAPContextRequired()) {
+        if (implementor.getContext() == null || !(implementor.getParentNode() instanceof OLAPJoinRel) || implementor.isNewOLAPContextRequired()) {
             implementor.allocateContext();
         }
 
@@ -289,8 +288,7 @@ public class OLAPTableScan extends TableScan implements OLAPRel, EnumerableRel {
         String execFunction = genExecFunc();
 
         PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), this.rowType, pref.preferArray());
-        MethodCallExpression exprCall = Expressions.call(table.getExpression(OLAPTable.class), execFunction,
-                implementor.getRootExpression(), Expressions.constant(context.id));
+        MethodCallExpression exprCall = Expressions.call(table.getExpression(OLAPTable.class), execFunction, implementor.getRootExpression(), Expressions.constant(context.id));
         return implementor.result(physType, Blocks.toBlock(exprCall));
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPToEnumerableConverter.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPToEnumerableConverter.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPToEnumerableConverter.java
index 8104a87..7ac86b2 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPToEnumerableConverter.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPToEnumerableConverter.java
@@ -125,10 +125,8 @@ public class OLAPToEnumerableConverter extends ConverterImpl implements Enumerab
     private void doAccessControl(OLAPContext context) {
         String controllerCls = KylinConfig.getInstanceFromEnv().getQueryAccessController();
         if (null != controllerCls && !controllerCls.isEmpty()) {
-            OLAPContext.IAccessController accessController = (OLAPContext.IAccessController) ClassUtil
-                    .newInstance(controllerCls);
-            TupleFilter tupleFilter = accessController.check(context.olapAuthen, context.allColumns,
-                    context.realization);
+            OLAPContext.IAccessController accessController = (OLAPContext.IAccessController) ClassUtil.newInstance(controllerCls);
+            TupleFilter tupleFilter = accessController.check(context.olapAuthen, context.allColumns, context.realization);
             if (null != tupleFilter) {
                 context.filterColumns.addAll(collectColumns(tupleFilter));
                 context.allColumns.addAll(collectColumns(tupleFilter));
@@ -163,9 +161,7 @@ public class OLAPToEnumerableConverter extends ConverterImpl implements Enumerab
         PhysType physType = PhysTypeImpl.of(enumImplementor.getTypeFactory(), hiveRowType, pref.preferArray());
 
         RelOptTable factTable = context.firstTableScan.getTable();
-        Result result = enumImplementor.result(physType,
-                Blocks.toBlock(Expressions.call(factTable.getExpression(OLAPTable.class), "executeHiveQuery",
-                        enumImplementor.getRootExpression())));
+        Result result = enumImplementor.result(physType, Blocks.toBlock(Expressions.call(factTable.getExpression(OLAPTable.class), "executeHiveQuery", enumImplementor.getRootExpression())));
         return result;
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPUnionRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPUnionRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPUnionRel.java
index 1a2d9e2..e04ba6f 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPUnionRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPUnionRel.java
@@ -122,7 +122,7 @@ public class OLAPUnionRel extends Union implements OLAPRel {
     @Override
     public boolean hasSubQuery() {
         for (RelNode child : getInputs()) {
-            if (((OLAPRel) child).hasSubQuery()) {
+            if (((OLAPRel)child).hasSubQuery()) {
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/relnode/OLAPWindowRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPWindowRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPWindowRel.java
index 79e5cad..c2ea4e2 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPWindowRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPWindowRel.java
@@ -21,9 +21,9 @@ package org.apache.kylin.query.relnode;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.calcite.adapter.enumerable.EnumerableWindowBridge;
 import org.apache.calcite.adapter.enumerable.EnumerableConvention;
 import org.apache.calcite.adapter.enumerable.EnumerableRel;
-import org.apache.calcite.adapter.enumerable.EnumerableWindowBridge;
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelOptCost;
 import org.apache.calcite.plan.RelOptPlanner;
@@ -34,20 +34,19 @@ import org.apache.calcite.rel.RelWriter;
 import org.apache.calcite.rel.core.AggregateCall;
 import org.apache.calcite.rel.core.Window;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
+
+import com.google.common.base.Preconditions;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexLiteral;
 import org.apache.kylin.metadata.model.TblColRef;
 
-import com.google.common.base.Preconditions;
-
 /**
  */
 public class OLAPWindowRel extends Window implements OLAPRel {
     private ColumnRowType columnRowType;
     private OLAPContext context;
 
-    public OLAPWindowRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, List<RexLiteral> constants,
-            RelDataType rowType, List<Group> groups) {
+    public OLAPWindowRel(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, List<RexLiteral> constants, RelDataType rowType, List<Group> groups) {
         super(cluster, traitSet, input, constants, rowType, groups);
         Preconditions.checkArgument(getConvention() == CONVENTION);
         Preconditions.checkArgument(getConvention() == input.getConvention());
@@ -91,8 +90,7 @@ public class OLAPWindowRel extends Window implements OLAPRel {
         // add window aggregate calls column
         for (Group group : groups) {
             for (AggregateCall aggrCall : group.getAggregateCalls(this)) {
-                TblColRef aggrCallCol = TblColRef.newInnerColumn(aggrCall.getName(),
-                        TblColRef.InnerDataTypeEnum.LITERAL);
+                TblColRef aggrCallCol = TblColRef.newInnerColumn(aggrCall.getName(), TblColRef.InnerDataTypeEnum.LITERAL);
                 columns.add(aggrCallCol);
             }
         }
@@ -115,8 +113,7 @@ public class OLAPWindowRel extends Window implements OLAPRel {
             }
             relInputs.add(input);
         }
-        return EnumerableWindowBridge.createEnumerableWindow(getCluster(), traitSet, inputs.get(0), constants, rowType,
-                groups);
+        return EnumerableWindowBridge.createEnumerableWindow(getCluster(), traitSet, inputs.get(0), constants, rowType, groups);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/routing/QueryRouter.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/QueryRouter.java b/query/src/main/java/org/apache/kylin/query/routing/QueryRouter.java
index ecb78cd..18db4ac 100644
--- a/query/src/main/java/org/apache/kylin/query/routing/QueryRouter.java
+++ b/query/src/main/java/org/apache/kylin/query/routing/QueryRouter.java
@@ -41,8 +41,7 @@ public class QueryRouter {
 
     private static final Logger logger = LoggerFactory.getLogger(QueryRouter.class);
 
-    public static IRealization selectRealization(OLAPContext olapContext, Set<IRealization> realizations)
-            throws NoRealizationFoundException {
+    public static IRealization selectRealization(OLAPContext olapContext, Set<IRealization> realizations) throws NoRealizationFoundException {
 
         String factTableName = olapContext.firstTableScan.getTableName();
         String projectName = olapContext.olapSchema.getProjectName();
@@ -54,8 +53,7 @@ public class QueryRouter {
                 candidates.add(new Candidate(real, sqlDigest));
         }
 
-        logger.info("Find candidates by table " + factTableName + " and project=" + projectName + " : "
-                + StringUtils.join(candidates, ","));
+        logger.info("Find candidates by table " + factTableName + " and project=" + projectName + " : " + StringUtils.join(candidates, ","));
 
         // rule based realization selection, rules might reorder realizations or remove specific realization
         RoutingRule.applyRules(candidates);
@@ -67,8 +65,7 @@ public class QueryRouter {
         Candidate chosen = candidates.get(0);
         adjustForDimensionAsMeasure(chosen, olapContext);
 
-        logger.info("The realizations remaining: " + RoutingRule.getPrintableText(candidates)
-                + " And the final chosen one is the first one");
+        logger.info("The realizations remaining: " + RoutingRule.getPrintableText(candidates) + " And the final chosen one is the first one");
 
         return chosen.realization;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/routing/RealizationChooser.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/RealizationChooser.java b/query/src/main/java/org/apache/kylin/query/routing/RealizationChooser.java
index 870ad26..a598ee6 100644
--- a/query/src/main/java/org/apache/kylin/query/routing/RealizationChooser.java
+++ b/query/src/main/java/org/apache/kylin/query/routing/RealizationChooser.java
@@ -130,8 +130,7 @@ public class RealizationChooser {
         KylinConfig kylinConfig = first.olapSchema.getConfig();
         String projectName = first.olapSchema.getProjectName();
         String factTableName = first.firstTableScan.getOlapTable().getTableName();
-        Set<IRealization> realizations = ProjectManager.getInstance(kylinConfig).getRealizationsByTable(projectName,
-                factTableName);
+        Set<IRealization> realizations = ProjectManager.getInstance(kylinConfig).getRealizationsByTable(projectName, factTableName);
 
         final Map<DataModelDesc, Set<IRealization>> models = Maps.newHashMap();
         final Map<DataModelDesc, RealizationCost> costs = Maps.newHashMap();
@@ -205,8 +204,7 @@ public class RealizationChooser {
             this.priority = Candidate.PRIORITIES.get(real.getType());
 
             // ref CubeInstance.getCost()
-            int c = real.getAllDimensions().size() * CubeInstance.COST_WEIGHT_DIMENSION
-                    + real.getMeasures().size() * CubeInstance.COST_WEIGHT_MEASURE;
+            int c = real.getAllDimensions().size() * CubeInstance.COST_WEIGHT_DIMENSION + real.getMeasures().size() * CubeInstance.COST_WEIGHT_MEASURE;
             for (JoinTableDesc join : real.getModel().getJoinTables()) {
                 if (join.getJoin().isInnerJoin())
                     c += CubeInstance.COST_WEIGHT_INNER_JOIN;

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/routing/RoutingRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/RoutingRule.java b/query/src/main/java/org/apache/kylin/query/routing/RoutingRule.java
index 5cf9ae8..53f871d 100644
--- a/query/src/main/java/org/apache/kylin/query/routing/RoutingRule.java
+++ b/query/src/main/java/org/apache/kylin/query/routing/RoutingRule.java
@@ -48,8 +48,7 @@ public abstract class RoutingRule {
             String before = getPrintableText(candidates);
             rule.apply(candidates);
             String after = getPrintableText(candidates);
-            logger.info(
-                    "Applying rule: " + rule + ", realizations before: " + before + ", realizations after: " + after);
+            logger.info("Applying rule: " + rule + ", realizations before: " + before + ", realizations after: " + after);
         }
     }
 
@@ -77,8 +76,7 @@ public abstract class RoutingRule {
      */
     public static void registerRule(RoutingRule rule, int applyOrder) {
         if (applyOrder > rules.size()) {
-            logger.warn("apply order " + applyOrder + "  is larger than rules size " + rules.size()
-                    + ", will put the new rule at the end");
+            logger.warn("apply order " + applyOrder + "  is larger than rules size " + rules.size() + ", will put the new rule at the end");
             rules.add(rule);
         }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/routing/rules/RealizationSortRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/rules/RealizationSortRule.java b/query/src/main/java/org/apache/kylin/query/routing/rules/RealizationSortRule.java
index 9f339eb..bd83af1 100644
--- a/query/src/main/java/org/apache/kylin/query/routing/rules/RealizationSortRule.java
+++ b/query/src/main/java/org/apache/kylin/query/routing/rules/RealizationSortRule.java
@@ -35,8 +35,7 @@ public class RealizationSortRule extends RoutingRule {
     public void apply(List<Candidate> candidates) {
         StringBuilder sb = new StringBuilder();
         for (Candidate candidate : candidates) {
-            sb.append(candidate.getRealization().getCanonicalName() + " priority " + candidate.getPriority() + " cost "
-                    + candidate.getCapability().cost + ". ");
+            sb.append(candidate.getRealization().getCanonicalName() + " priority " + candidate.getPriority() + " cost " + candidate.getCapability().cost + ". ");
         }
         logger.info(sb.toString());
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/routing/rules/RemoveBlackoutRealizationsRule.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/routing/rules/RemoveBlackoutRealizationsRule.java b/query/src/main/java/org/apache/kylin/query/routing/rules/RemoveBlackoutRealizationsRule.java
index 7cf4663..f309757 100644
--- a/query/src/main/java/org/apache/kylin/query/routing/rules/RemoveBlackoutRealizationsRule.java
+++ b/query/src/main/java/org/apache/kylin/query/routing/rules/RemoveBlackoutRealizationsRule.java
@@ -40,10 +40,10 @@ public class RemoveBlackoutRealizationsRule extends RoutingRule {
             return false;
         if (!whiteList.isEmpty() && !whiteList.contains(real.getCanonicalName()))
             return false;
-
+        
         return true;
     }
-
+    
     @Override
     public void apply(List<Candidate> candidates) {
         for (Iterator<Candidate> iterator = candidates.iterator(); iterator.hasNext();) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/schema/OLAPTable.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/schema/OLAPTable.java b/query/src/main/java/org/apache/kylin/query/schema/OLAPTable.java
index 44ee956..21d2fc1 100644
--- a/query/src/main/java/org/apache/kylin/query/schema/OLAPTable.java
+++ b/query/src/main/java/org/apache/kylin/query/schema/OLAPTable.java
@@ -172,8 +172,7 @@ public class OLAPTable extends AbstractQueryableTable implements TranslatableTab
         List<ColumnDesc> tableColumns = mgr.listExposedColumns(olapSchema.getProjectName(), sourceTable);
 
         List<ColumnDesc> metricColumns = Lists.newArrayList();
-        List<MeasureDesc> countMeasures = mgr.listEffectiveRewriteMeasures(olapSchema.getProjectName(),
-                sourceTable.getIdentity());
+        List<MeasureDesc> countMeasures = mgr.listEffectiveRewriteMeasures(olapSchema.getProjectName(), sourceTable.getIdentity());
         HashSet<String> metFields = new HashSet<String>();
         for (MeasureDesc m : countMeasures) {
 
@@ -203,13 +202,11 @@ public class OLAPTable extends AbstractQueryableTable implements TranslatableTab
         }
         //2. All integer measures in non-cube realizations
         for (IRealization realization : mgr.listAllRealizations(olapSchema.getProjectName())) {
-            if (realization.getType() == RealizationType.INVERTED_INDEX
-                    && realization.getModel().isFactTable(sourceTable.getIdentity())) {
+            if (realization.getType() == RealizationType.INVERTED_INDEX && realization.getModel().isFactTable(sourceTable.getIdentity())) {
                 DataModelDesc model = realization.getModel();
                 for (String metricColumn : model.getMetrics()) {
                     TblColRef col = model.findColumn(metricColumn);
-                    if (col.getTable().equals(sourceTable.getIdentity()) && col.getType().isIntegerFamily()
-                            && !col.getType().isBigInt())
+                    if (col.getTable().equals(sourceTable.getIdentity()) && col.getType().isIntegerFamily() && !col.getType().isBigInt())
                         upgradeCols.add(col.getColumnDesc());
                 }
             }
@@ -218,12 +215,10 @@ public class OLAPTable extends AbstractQueryableTable implements TranslatableTab
         for (ColumnDesc upgrade : upgradeCols) {
             int index = tableColumns.indexOf(upgrade);
             if (index < 0) {
-                throw new IllegalStateException(
-                        "Metric column " + upgrade + " is not found in the the project's columns");
+                throw new IllegalStateException("Metric column " + upgrade + " is not found in the the project's columns");
             }
             tableColumns.get(index).setUpgradedType("bigint");
-            logger.info("To avoid overflow, upgraded {}'s type from {} to {}", tableColumns.get(index),
-                    tableColumns.get(index).getType(), tableColumns.get(index).getUpgradedType());
+            logger.info("To avoid overflow, upgraded {}'s type from {} to {}", tableColumns.get(index), tableColumns.get(index).getType(), tableColumns.get(index).getUpgradedType());
         }
 
         Collections.sort(tableColumns, new Comparator<ColumnDesc>() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/util/CognosParenthesesEscape.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/util/CognosParenthesesEscape.java b/query/src/main/java/org/apache/kylin/query/util/CognosParenthesesEscape.java
index a8dfda1..6d930a5 100644
--- a/query/src/main/java/org/apache/kylin/query/util/CognosParenthesesEscape.java
+++ b/query/src/main/java/org/apache/kylin/query/util/CognosParenthesesEscape.java
@@ -29,8 +29,7 @@ import java.util.regex.Pattern;
 import com.google.common.collect.Lists;
 
 public class CognosParenthesesEscape implements QueryUtil.IQueryTransformer {
-    private static final Pattern FROM_PATTERN = Pattern.compile("\\s+from\\s+(\\s*\\(\\s*)+(?!\\s*select\\s)",
-            Pattern.CASE_INSENSITIVE);
+    private static final Pattern FROM_PATTERN = Pattern.compile("\\s+from\\s+(\\s*\\(\\s*)+(?!\\s*select\\s)", Pattern.CASE_INSENSITIVE);
 
     @Override
     public String transform(String sql) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java b/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
index d891aed..d48a26f 100644
--- a/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
+++ b/query/src/main/java/org/apache/kylin/query/util/QueryUtil.java
@@ -92,19 +92,12 @@ public class QueryUtil {
         private static final String S0 = "\\s*";
         private static final String S1 = "\\s";
         private static final String SM = "\\s+";
-        private static final Pattern PTN_GROUP_BY = Pattern.compile(S1 + "GROUP" + SM + "BY" + S1,
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_HAVING_COUNT_GREATER_THAN_ZERO = Pattern.compile(S1 + "HAVING" + SM + "[(]?"
-                + S0 + "COUNT" + S0 + "[(]" + S0 + "1" + S0 + "[)]" + S0 + ">" + S0 + "0" + S0 + "[)]?",
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_SUM_1 = Pattern.compile(S0 + "SUM" + S0 + "[(]" + S0 + "[1]" + S0 + "[)]" + S0,
-                Pattern.CASE_INSENSITIVE);
+        private static final Pattern PTN_GROUP_BY = Pattern.compile(S1 + "GROUP" + SM + "BY" + S1, Pattern.CASE_INSENSITIVE);
+        private static final Pattern PTN_HAVING_COUNT_GREATER_THAN_ZERO = Pattern.compile(S1 + "HAVING" + SM + "[(]?" + S0 + "COUNT" + S0 + "[(]" + S0 + "1" + S0 + "[)]" + S0 + ">" + S0 + "0" + S0 + "[)]?", Pattern.CASE_INSENSITIVE);
+        private static final Pattern PTN_SUM_1 = Pattern.compile(S0 + "SUM" + S0 + "[(]" + S0 + "[1]" + S0 + "[)]" + S0, Pattern.CASE_INSENSITIVE);
         private static final Pattern PTN_NOT_EQ = Pattern.compile(S0 + "!=" + S0, Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_INTERVAL = Pattern.compile(
-                "interval" + SM + "(floor\\()([\\d\\.]+)(\\))" + SM + "(second|minute|hour|day|month|year)",
-                Pattern.CASE_INSENSITIVE);
-        private static final Pattern PTN_HAVING_ESCAPE_FUNCTION = Pattern.compile("\\{fn" + "(.*?)" + "\\}",
-                Pattern.CASE_INSENSITIVE);
+        private static final Pattern PTN_INTERVAL = Pattern.compile("interval" + SM + "(floor\\()([\\d\\.]+)(\\))" + SM + "(second|minute|hour|day|month|year)", Pattern.CASE_INSENSITIVE);
+        private static final Pattern PTN_HAVING_ESCAPE_FUNCTION = Pattern.compile("\\{fn" + "(.*?)" + "\\}", Pattern.CASE_INSENSITIVE);
 
         @Override
         public String transform(String sql) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/test/java/org/apache/kylin/query/QueryDataSourceTest.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/org/apache/kylin/query/QueryDataSourceTest.java b/query/src/test/java/org/apache/kylin/query/QueryDataSourceTest.java
index 1606c70..2c06be8 100644
--- a/query/src/test/java/org/apache/kylin/query/QueryDataSourceTest.java
+++ b/query/src/test/java/org/apache/kylin/query/QueryDataSourceTest.java
@@ -87,10 +87,10 @@ public class QueryDataSourceTest extends LocalFileMetadataTestCase {
         dsCache.clearCache();
     }
 
-    @Test(timeout = 10000)
+    @Test(timeout=10000)
     public void testMaxConnLimit() throws SQLException {
         KylinConfig config = KylinConfig.getInstanceFromEnv();
-
+        
         // Test with connection limit 
         Properties props = new Properties();
         props.setProperty("maxActive", "3");
@@ -109,7 +109,7 @@ public class QueryDataSourceTest extends LocalFileMetadataTestCase {
         DBUtils.closeQuietly(ds1Conn1);
         DBUtils.closeQuietly(ds1Conn2);
         DBUtils.closeQuietly(ds1Conn3);
-
+        
         // Test with not connection limit
         DataSource ds2 = QueryDataSource.create("default", config);
         Connection ds2Conn1 = ds2.getConnection();

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/test/java/org/apache/kylin/query/util/CognosParenthesesEscapeTest.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/org/apache/kylin/query/util/CognosParenthesesEscapeTest.java b/query/src/test/java/org/apache/kylin/query/util/CognosParenthesesEscapeTest.java
index c8ac432..153c097 100644
--- a/query/src/test/java/org/apache/kylin/query/util/CognosParenthesesEscapeTest.java
+++ b/query/src/test/java/org/apache/kylin/query/util/CognosParenthesesEscapeTest.java
@@ -40,10 +40,8 @@ public class CognosParenthesesEscapeTest {
     @Test
     public void advanced1Test() throws IOException {
         CognosParenthesesEscape escape = new CognosParenthesesEscape();
-        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query01.sql"),
-                Charset.defaultCharset());
-        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query01.sql.expected"),
-                Charset.defaultCharset());
+        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query01.sql"), Charset.defaultCharset());
+        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query01.sql.expected"), Charset.defaultCharset());
         String transformed = escape.transform(query);
         //System.out.println(transformed);
         Assert.assertEquals(expected, transformed);
@@ -52,10 +50,8 @@ public class CognosParenthesesEscapeTest {
     @Test
     public void advanced2Test() throws IOException {
         CognosParenthesesEscape escape = new CognosParenthesesEscape();
-        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query02.sql"),
-                Charset.defaultCharset());
-        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query02.sql.expected"),
-                Charset.defaultCharset());
+        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query02.sql"), Charset.defaultCharset());
+        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query02.sql.expected"), Charset.defaultCharset());
         String transformed = escape.transform(query);
         //System.out.println(transformed);
         Assert.assertEquals(expected, transformed);
@@ -64,10 +60,8 @@ public class CognosParenthesesEscapeTest {
     @Test
     public void advanced3Test() throws IOException {
         CognosParenthesesEscape escape = new CognosParenthesesEscape();
-        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query03.sql"),
-                Charset.defaultCharset());
-        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query03.sql.expected"),
-                Charset.defaultCharset());
+        String query = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query03.sql"), Charset.defaultCharset());
+        String expected = FileUtils.readFileToString(new File("src/test/resources/query/cognos/query03.sql.expected"), Charset.defaultCharset());
         String transformed = escape.transform(query);
         //System.out.println(transformed);
         Assert.assertEquals(expected, transformed);
@@ -76,8 +70,7 @@ public class CognosParenthesesEscapeTest {
     @Test
     public void proguardTest() throws IOException {
         CognosParenthesesEscape escape = new CognosParenthesesEscape();
-        Collection<File> files = FileUtils.listFiles(new File("../kylin-it/src/test/resources"), new String[] { "sql" },
-                true);
+        Collection<File> files = FileUtils.listFiles(new File("../kylin-it/src/test/resources"), new String[] { "sql" }, true);
         for (File f : files) {
             System.out.println("checking " + f.getAbsolutePath());
             String query = FileUtils.readFileToString(f, Charset.defaultCharset());

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/query/src/test/java/org/apache/kylin/query/util/QueryUtilTest.java
----------------------------------------------------------------------
diff --git a/query/src/test/java/org/apache/kylin/query/util/QueryUtilTest.java b/query/src/test/java/org/apache/kylin/query/util/QueryUtilTest.java
index b38393c..a1edd89 100644
--- a/query/src/test/java/org/apache/kylin/query/util/QueryUtilTest.java
+++ b/query/src/test/java/org/apache/kylin/query/util/QueryUtilTest.java
@@ -46,9 +46,7 @@ public class QueryUtilTest extends LocalFileMetadataTestCase {
         {
             String sql = "select ( date '2001-09-28' + interval floor(2) month) from test_kylin_fact group by ( date '2001-09-28' + interval floor(2) month)";
             String s = QueryUtil.massageSql(sql, 0, 0);
-            Assert.assertEquals(
-                    "select ( date '2001-09-28' + interval '2' month) from test_kylin_fact group by ( date '2001-09-28' + interval '2' month)",
-                    s);
+            Assert.assertEquals("select ( date '2001-09-28' + interval '2' month) from test_kylin_fact group by ( date '2001-09-28' + interval '2' month)", s);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/adhoc/AdHocRunnerJdbcImpl.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/adhoc/AdHocRunnerJdbcImpl.java b/server-base/src/main/java/org/apache/kylin/rest/adhoc/AdHocRunnerJdbcImpl.java
index 2ce8f0a..275fce5 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/adhoc/AdHocRunnerJdbcImpl.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/adhoc/AdHocRunnerJdbcImpl.java
@@ -28,9 +28,9 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.kylin.storage.adhoc.AdHocRunnerBase;
 import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.metadata.querymeta.SelectedColumnMeta;
-import org.apache.kylin.storage.adhoc.AdHocRunnerBase;
 
 public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
 
@@ -48,8 +48,7 @@ public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
     public void init() {
         if (this.pool == null) {
             this.pool = new JdbcConnectionPool();
-            JdbcConnectionFactory factory = new JdbcConnectionFactory(this.config.getJdbcUrl(),
-                    this.config.getJdbcDriverClass(), this.config.getJdbcUsername(), this.config.getJdbcPassword());
+            JdbcConnectionFactory factory = new JdbcConnectionFactory(this.config.getJdbcUrl(), this.config.getJdbcDriverClass(), this.config.getJdbcUsername(), this.config.getJdbcPassword());
             GenericObjectPool.Config poolConfig = new GenericObjectPool.Config();
             poolConfig.maxActive = this.config.getPoolMaxTotal();
             poolConfig.maxIdle = this.config.getPoolMaxIdle();
@@ -64,8 +63,7 @@ public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
     }
 
     @Override
-    public void executeQuery(String query, List<List<String>> results, List<SelectedColumnMeta> columnMetas)
-            throws Exception {
+    public void executeQuery(String query, List<List<String>> results, List<SelectedColumnMeta> columnMetas) throws Exception {
         Statement statement = null;
         Connection connection = this.getConnection();
         ResultSet resultSet = null;
@@ -87,11 +85,7 @@ public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
 
             // fill in selected column meta
             for (int i = 1; i <= columnCount; ++i) {
-                columnMetas.add(new SelectedColumnMeta(metaData.isAutoIncrement(i), metaData.isCaseSensitive(i), false,
-                        metaData.isCurrency(i), metaData.isNullable(i), false, metaData.getColumnDisplaySize(i),
-                        metaData.getColumnLabel(i), metaData.getColumnName(i), null, null, null,
-                        metaData.getPrecision(i), metaData.getScale(i), metaData.getColumnType(i),
-                        metaData.getColumnTypeName(i), metaData.isReadOnly(i), false, false));
+                columnMetas.add(new SelectedColumnMeta(metaData.isAutoIncrement(i), metaData.isCaseSensitive(i), false, metaData.isCurrency(i), metaData.isNullable(i), false, metaData.getColumnDisplaySize(i), metaData.getColumnLabel(i), metaData.getColumnName(i), null, null, null, metaData.getPrecision(i), metaData.getScale(i), metaData.getColumnType(i), metaData.getColumnTypeName(i), metaData.isReadOnly(i), false, false));
             }
 
         } catch (SQLException sqlException) {
@@ -109,6 +103,7 @@ public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
         this.pool.returnConnection(connection);
     }
 
+
     static void extractResults(ResultSet resultSet, List<List<String>> results) throws SQLException {
         List<String> oneRow = new LinkedList<String>();
 
@@ -127,4 +122,5 @@ public class AdHocRunnerJdbcImpl extends AdHocRunnerBase {
         }
     }
 
-}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionFactory.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionFactory.java b/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionFactory.java
index a316342..42613fe 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionFactory.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionFactory.java
@@ -18,12 +18,13 @@
 
 package org.apache.kylin.rest.adhoc;
 
+
+import org.apache.commons.pool.PoolableObjectFactory;
+
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
-import org.apache.commons.pool.PoolableObjectFactory;
-
 class JdbcConnectionFactory implements PoolableObjectFactory {
 
     private final String jdbcUrl;
@@ -34,6 +35,7 @@ class JdbcConnectionFactory implements PoolableObjectFactory {
 
     private final String password;
 
+
     public JdbcConnectionFactory(String jdbcUrl, String driverClass, String username, String password) {
         this.jdbcUrl = jdbcUrl;
         this.driverClass = driverClass;
@@ -47,12 +49,14 @@ class JdbcConnectionFactory implements PoolableObjectFactory {
         }
     }
 
+
     @Override
     public Connection makeObject() throws Exception {
         Connection connection = DriverManager.getConnection(jdbcUrl, username, password);
         return connection;
     }
 
+
     @Override
     public void activateObject(Object o) throws Exception {
 
@@ -66,7 +70,7 @@ class JdbcConnectionFactory implements PoolableObjectFactory {
     @Override
     public void destroyObject(Object pooledObject) throws Exception {
 
-        if (pooledObject instanceof Connection) {
+        if(pooledObject instanceof Connection) {
             Connection connection = (Connection) pooledObject;
 
             if (connection != null)
@@ -77,7 +81,7 @@ class JdbcConnectionFactory implements PoolableObjectFactory {
 
     @Override
     public boolean validateObject(Object pooledObject) {
-        if (pooledObject instanceof Connection) {
+        if(pooledObject instanceof Connection) {
             Connection connection = (Connection) pooledObject;
 
             if (connection != null) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionPool.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionPool.java b/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionPool.java
index f5f4606..8954d22 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionPool.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/adhoc/JdbcConnectionPool.java
@@ -18,16 +18,19 @@
 
 package org.apache.kylin.rest.adhoc;
 
+
 import java.io.Closeable;
 import java.io.IOException;
 import java.sql.Connection;
 
 import org.apache.commons.pool.impl.GenericObjectPool;
 
+
 public class JdbcConnectionPool implements Closeable {
 
     private GenericObjectPool internalPool = null;
 
+
     public void createPool(JdbcConnectionFactory factory, GenericObjectPool.Config poolConfig) throws IOException {
         if (this.internalPool != null)
             this.close();
@@ -70,4 +73,4 @@ public class JdbcConnectionPool implements Closeable {
             throw new RuntimeException(e.getMessage(), e);
         }
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/constant/Constant.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/constant/Constant.java b/server-base/src/main/java/org/apache/kylin/rest/constant/Constant.java
index f0899ce..f068e5f 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/constant/Constant.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/constant/Constant.java
@@ -37,8 +37,7 @@ public class Constant {
     public final static String ACCESS_HAS_ROLE_ADMIN = "hasRole('ROLE_ADMIN')";
     public final static String ACCESS_HAS_ROLE_MODELER = "hasRole('ROLE_MODELER')";
 
-    public final static String ACCESS_POST_FILTER_READ = "hasRole('ROLE_ADMIN') or hasPermission(filterObject, 'READ') or hasPermission(filterObject, 'MANAGEMENT') "
-            + "or hasPermission(filterObject, 'OPERATION') or hasPermission(filterObject, 'ADMINISTRATION')";
+    public final static String ACCESS_POST_FILTER_READ = "hasRole('ROLE_ADMIN') or hasPermission(filterObject, 'READ') or hasPermission(filterObject, 'MANAGEMENT') " + "or hasPermission(filterObject, 'OPERATION') or hasPermission(filterObject, 'ADMINISTRATION')";
 
     public final static String SERVER_MODE_QUERY = "query";
     public final static String SERVER_MODE_JOB = "job";

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
index 440caba..a88c342 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/AccessController.java
@@ -73,8 +73,7 @@ public class AccessController extends BasicController {
      */
     @RequestMapping(value = "/{type}/{uuid}", method = { RequestMethod.POST }, produces = { "application/json" })
     @ResponseBody
-    public List<AccessEntryResponse> grant(@PathVariable String type, @PathVariable String uuid,
-            @RequestBody AccessRequest accessRequest) {
+    public List<AccessEntryResponse> grant(@PathVariable String type, @PathVariable String uuid, @RequestBody AccessRequest accessRequest) {
         AclEntity ae = accessService.getAclEntity(type, uuid);
         Sid sid = accessService.getSid(accessRequest.getSid(), accessRequest.isPrincipal());
         Permission permission = AclPermissionFactory.getPermission(accessRequest.getPermission());
@@ -90,8 +89,7 @@ public class AccessController extends BasicController {
      */
     @RequestMapping(value = "/{type}/{uuid}", method = { RequestMethod.PUT }, produces = { "application/json" })
     @ResponseBody
-    public List<AccessEntryResponse> update(@PathVariable String type, @PathVariable String uuid,
-            @RequestBody AccessRequest accessRequest) {
+    public List<AccessEntryResponse> update(@PathVariable String type, @PathVariable String uuid, @RequestBody AccessRequest accessRequest) {
         AclEntity ae = accessService.getAclEntity(type, uuid);
         Permission permission = AclPermissionFactory.getPermission(accessRequest.getPermission());
         Acl acl = accessService.update(ae, accessRequest.getAccessEntryId(), permission);
@@ -105,8 +103,7 @@ public class AccessController extends BasicController {
      * @param accessRequest
      */
     @RequestMapping(value = "/{type}/{uuid}", method = { RequestMethod.DELETE }, produces = { "application/json" })
-    public List<AccessEntryResponse> revoke(@PathVariable String type, @PathVariable String uuid,
-            AccessRequest accessRequest) {
+    public List<AccessEntryResponse> revoke(@PathVariable String type, @PathVariable String uuid, AccessRequest accessRequest) {
         AclEntity ae = accessService.getAclEntity(type, uuid);
         Acl acl = accessService.revoke(ae, accessRequest.getAccessEntryId());
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
index d9d171a..eb4b6ed 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
@@ -59,8 +59,7 @@ public class BasicController {
         Throwable cause = ex;
         while (cause != null) {
             if (cause.getClass().getPackage().getName().startsWith("org.apache.hadoop.hbase")) {
-                return new ErrorResponse(req.getRequestURL().toString(),
-                        new InternalErrorException(String.format(msg.getHBASE_FAIL(), ex.getMessage()), ex));
+                return new ErrorResponse(req.getRequestURL().toString(), new InternalErrorException(String.format(msg.getHBASE_FAIL(), ex.getMessage()), ex));
             }
             cause = cause.getCause();
         }
@@ -98,8 +97,7 @@ public class BasicController {
 
     protected void setDownloadResponse(String downloadFile, final HttpServletResponse response) {
         File file = new File(downloadFile);
-        try (InputStream fileInputStream = new FileInputStream(file);
-                OutputStream output = response.getOutputStream();) {
+        try (InputStream fileInputStream = new FileInputStream(file); OutputStream output = response.getOutputStream();) {
             response.reset();
             response.setContentType("application/octet-stream");
             response.setContentLength((int) (file.length()));

http://git-wip-us.apache.org/repos/asf/kylin/blob/19585846/server-base/src/main/java/org/apache/kylin/rest/controller/CacheController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/CacheController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/CacheController.java
index a6b1d1b..092220c 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/CacheController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/CacheController.java
@@ -52,22 +52,18 @@ public class CacheController extends BasicController {
     /**
      * Announce wipe cache to all cluster nodes
      */
-    @RequestMapping(value = "/announce/{entity}/{cacheKey}/{event}", method = { RequestMethod.PUT }, produces = {
-            "application/json" })
+    @RequestMapping(value = "/announce/{entity}/{cacheKey}/{event}", method = { RequestMethod.PUT }, produces = { "application/json" })
     @ResponseBody
-    public void announceWipeCache(@PathVariable String entity, @PathVariable String event,
-            @PathVariable String cacheKey) throws IOException {
+    public void announceWipeCache(@PathVariable String entity, @PathVariable String event, @PathVariable String cacheKey) throws IOException {
         cacheService.annouceWipeCache(entity, event, cacheKey);
     }
 
     /**
      * Wipe cache on this node
      */
-    @RequestMapping(value = "/{entity}/{cacheKey}/{event}", method = { RequestMethod.PUT }, produces = {
-            "application/json" })
+    @RequestMapping(value = "/{entity}/{cacheKey}/{event}", method = { RequestMethod.PUT }, produces = { "application/json" })
     @ResponseBody
-    public void wipeCache(@PathVariable String entity, @PathVariable String event, @PathVariable String cacheKey)
-            throws IOException {
+    public void wipeCache(@PathVariable String entity, @PathVariable String event, @PathVariable String cacheKey) throws IOException {
         cacheService.notifyMetadataChange(entity, Broadcaster.Event.getEvent(event), cacheKey);
     }
 


Mime
View raw message