tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject tajo git commit: TAJO-1392: Resolve findbug warnings on Tajo Plan Module
Date Fri, 20 Mar 2015 03:04:32 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 5260c1e06 -> 154f5b9e1


TAJO-1392: Resolve findbug warnings on Tajo Plan Module

Closes #424


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/154f5b9e
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/154f5b9e
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/154f5b9e

Branch: refs/heads/master
Commit: 154f5b9e1c619ce4327aa055fb3ef02d6030fc0d
Parents: 5260c1e
Author: Jihun Kang <jihun@apache.org>
Authored: Fri Mar 20 12:03:19 2015 +0900
Committer: Jihun Kang <jihun@apache.org>
Committed: Fri Mar 20 12:03:19 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 ++
 .../org/apache/tajo/plan/ExprAnnotator.java     |  2 +-
 .../java/org/apache/tajo/plan/LogicalPlan.java  |  2 --
 .../plan/expr/AggregationFunctionCallEval.java  | 14 ++++++++++
 .../apache/tajo/plan/expr/AlgebraicUtil.java    |  5 ++++
 .../tajo/plan/expr/BetweenPredicateEval.java    | 14 ++++++++++
 .../org/apache/tajo/plan/expr/CaseWhenEval.java | 25 ++++++++++++++---
 .../org/apache/tajo/plan/expr/CastEval.java     | 10 +++++++
 .../org/apache/tajo/plan/expr/EvalTreeUtil.java |  5 +++-
 .../java/org/apache/tajo/plan/expr/InEval.java  | 10 +++++++
 .../org/apache/tajo/plan/expr/IsNullEval.java   |  9 +++++++
 .../tajo/plan/expr/PartialBinaryExpr.java       |  5 +---
 .../tajo/plan/expr/RegexPredicateEval.java      | 25 +++++++++++++++++
 .../apache/tajo/plan/expr/RowConstantEval.java  | 11 ++++++++
 .../tajo/plan/expr/WindowFunctionEval.java      | 14 ++++++++++
 .../GreedyHeuristicJoinOrderAlgorithm.java      |  4 ++-
 .../tajo/plan/logical/AlterTableNode.java       | 14 ++++++++++
 .../tajo/plan/logical/DistinctGroupbyNode.java  | 17 +++++++++++-
 .../apache/tajo/plan/logical/EvalExprNode.java  | 18 ++++++++++---
 .../apache/tajo/plan/logical/GroupbyNode.java   | 16 ++++++++++-
 .../apache/tajo/plan/logical/HavingNode.java    |  9 +++++++
 .../apache/tajo/plan/logical/IndexScanNode.java | 13 +++++++++
 .../apache/tajo/plan/logical/InsertNode.java    | 13 +++++++++
 .../org/apache/tajo/plan/logical/JoinNode.java  | 13 +++++++++
 .../org/apache/tajo/plan/logical/LimitNode.java | 11 +++++++-
 .../apache/tajo/plan/logical/LogicalNode.java   | 27 ++++++++++++++-----
 .../tajo/plan/logical/PersistentStoreNode.java  | 10 +++++++
 .../tajo/plan/logical/ProjectionNode.java       | 28 ++++++++++++++------
 .../apache/tajo/plan/logical/SelectionNode.java |  9 +++++++
 .../tajo/plan/logical/ShuffleFileWriteNode.java | 13 +++++++++
 .../org/apache/tajo/plan/logical/SortNode.java  | 14 +++++++++-
 .../tajo/plan/logical/StoreTableNode.java       | 10 +++++++
 .../tajo/plan/nameresolver/NameResolver.java    |  4 +--
 .../plan/rewrite/rules/FilterPushDownRule.java  | 10 ++++---
 .../tajo/plan/serder/EvalNodeDeserializer.java  | 17 +++++++++++-
 .../tajo/plan/verifier/LogicalPlanVerifier.java |  7 -----
 .../plan/verifier/PreLogicalPlanVerifier.java   | 19 +------------
 .../plan/visitor/BasicLogicalPlanVisitor.java   |  6 ++---
 38 files changed, 387 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bac5461..38bd330 100644
--- a/CHANGES
+++ b/CHANGES
@@ -85,6 +85,8 @@ Release 0.11.0 - unreleased
 
   SUB TASKS
 
+    TAJO-1392: Resolve findbug warnings on Tajo Plan Module. (jihun)
+
     TAJO-1393: Resolve findbug warnings on Tajo Cli Module.
     (Contributed by Dongjoon Hyun, Committed by hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java b/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
index 5166e80..127d5bd 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
@@ -805,7 +805,7 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context, Eva
   public EvalNode visitLiteral(Context ctx, Stack<Expr> stack, LiteralValue expr) throws PlanningException {
     switch (expr.getValueType()) {
     case Boolean:
-      return new ConstEval(DatumFactory.createBool(((BooleanLiteral) expr).isTrue()));
+      return new ConstEval(DatumFactory.createBool(Boolean.parseBoolean(expr.getValue())));
     case String:
       return new ConstEval(DatumFactory.createText(expr.getValue()));
     case Unsigned_Integer:

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlan.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlan.java b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlan.java
index 3baf61d..0425f2e 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlan.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlan.java
@@ -67,12 +67,10 @@ public class LogicalPlan {
 
   /** planning and optimization log */
   private List<String> planingHistory = Lists.newArrayList();
-  LogicalPlanner planner;
 
   private boolean isExplain;
 
   public LogicalPlan(LogicalPlanner planner) {
-    this.planner = planner;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AggregationFunctionCallEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AggregationFunctionCallEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AggregationFunctionCallEval.java
index ca8c110..3ffe20e 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AggregationFunctionCallEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AggregationFunctionCallEval.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.expr;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.FunctionDesc;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes.DataType;
@@ -142,6 +143,19 @@ public class AggregationFunctionCallEval extends FunctionEval implements Cloneab
     this.intermediatePhase = true;
   }
 
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((alias == null) ? 0 : alias.hashCode());
+    result = prime * result + (finalPhase ? 1231 : 1237);
+    result = prime * result + ((instance == null) ? 0 : instance.hashCode());
+    result = prime * result + (intermediatePhase ? 1231 : 1237);
+    result = prime * result + ((params == null) ? 0 : params.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof AggregationFunctionCallEval) {
       AggregationFunctionCallEval other = (AggregationFunctionCallEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
index 84352f0..9ecb93c 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
@@ -342,6 +342,11 @@ public class AlgebraicUtil {
   }
 
   private static EvalNode createSingletonExprFromCNFRecursive(EvalNode[] evalNode, int idx) {
+    if (idx >= evalNode.length) {
+      throw new ArrayIndexOutOfBoundsException("index " + idx + " is exceeded the maximum length ("+
+          evalNode.length+") of EvalNode");
+    }
+
     if (idx == evalNode.length - 2) {
       return new BinaryEval(EvalType.AND, evalNode[idx], evalNode[idx + 1]);
     } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BetweenPredicateEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BetweenPredicateEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BetweenPredicateEval.java
index 84197e8..b0fbd5e 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BetweenPredicateEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BetweenPredicateEval.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.expr;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes;
@@ -230,6 +231,19 @@ public class BetweenPredicateEval extends EvalNode implements Cloneable {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((begin == null) ? 0 : begin.hashCode());
+    result = prime * result + ((checker == null) ? 0 : checker.hashCode());
+    result = prime * result + ((end == null) ? 0 : end.hashCode());
+    result = prime * result + (not ? 1231 : 1237);
+    result = prime * result + ((predicand == null) ? 0 : predicand.hashCode());
+    result = prime * result + (symmetric ? 1231 : 1237);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof BetweenPredicateEval) {
       BetweenPredicateEval another = (BetweenPredicateEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CaseWhenEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CaseWhenEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CaseWhenEval.java
index 4321d02..4d42db5 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CaseWhenEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CaseWhenEval.java
@@ -20,6 +20,7 @@ package org.apache.tajo.plan.expr;
 
 import com.google.common.collect.Lists;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes;
@@ -164,6 +165,15 @@ public class CaseWhenEval extends EvalNode implements GsonObject {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((elseResult == null) ? 0 : elseResult.hashCode());
+    result = prime * result + ((whens == null) ? 0 : whens.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof CaseWhenEval) {
       CaseWhenEval other = (CaseWhenEval) obj;
@@ -240,9 +250,18 @@ public class CaseWhenEval extends EvalNode implements GsonObject {
     }
 
     @Override
-    public boolean equals(Object object) {
-      if (object instanceof IfThenEval) {
-        IfThenEval other = (IfThenEval) object;
+    public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((condition == null) ? 0 : condition.hashCode());
+      result = prime * result + ((this.result == null) ? 0 : this.result.hashCode());
+      return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      if (obj instanceof IfThenEval) {
+        IfThenEval other = (IfThenEval) obj;
         return condition.equals(other.condition) && result.equals(other.result);
       } else {
         return false;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CastEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CastEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CastEval.java
index 3cad842..9f7f69f 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CastEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/CastEval.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.expr;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.OverridableConf;
 import org.apache.tajo.SessionVars;
 import org.apache.tajo.catalog.Schema;
@@ -81,6 +82,15 @@ public class CastEval extends UnaryEval {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((target == null) ? 0 : target.hashCode());
+    result = prime * result + ((timezone == null) ? 0 : timezone.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     boolean valid = obj != null && obj instanceof CastEval;
     if (valid) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
index f1d4498..23b4659 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
@@ -233,6 +233,9 @@ public class EvalTreeUtil {
       if (containColumnRef(expr, target)) {          
         exprSet.add(expr);
       }
+      break;
+    default:
+      break;
     }    
   }
   
@@ -318,7 +321,7 @@ public class EvalTreeUtil {
         } else if (leftSchema != null && rightSchema != null) {
           ensureColumnsOfDifferentTables = isJoinQualwithSchemas(leftSchema, rightSchema, leftColumn, rightColumn);
         } else {
-          ensureColumnsOfDifferentTables = isJoinQualWithOnlyColumns(block, leftColumn, rightColumn);
+          ensureColumnsOfDifferentTables = isJoinQualWithOnlyColumns(null, leftColumn, rightColumn);
         }
       }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/InEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/InEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/InEval.java
index 4dcc7bf..e60b68a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/InEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/InEval.java
@@ -21,6 +21,7 @@ package org.apache.tajo.plan.expr;
 
 import com.google.common.collect.Sets;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes;
@@ -72,6 +73,15 @@ public class InEval extends BinaryEval {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + (not ? 1231 : 1237);
+    result = prime * result + ((values == null) ? 0 : values.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof InEval) {
       InEval other = (InEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/IsNullEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/IsNullEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/IsNullEval.java
index 6a17bf8..16fc4f0 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/IsNullEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/IsNullEval.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.expr;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes;
@@ -66,6 +67,14 @@ public class IsNullEval extends UnaryEval {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + (isNot ? 1231 : 1237);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof IsNullEval) {
       IsNullEval other = (IsNullEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/PartialBinaryExpr.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/PartialBinaryExpr.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/PartialBinaryExpr.java
index 3aded7b..9f6d6d6 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/PartialBinaryExpr.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/PartialBinaryExpr.java
@@ -56,10 +56,7 @@ public class PartialBinaryExpr extends BinaryEval {
   @Override
   public boolean equals(Object obj) {
     if (obj instanceof PartialBinaryExpr) {
-      PartialBinaryExpr other = (PartialBinaryExpr) obj;
-      return type.equals(other.type) &&
-          leftExpr.equals(other.leftExpr) &&
-          rightExpr.equals(other.rightExpr);
+      return super.equals(obj);
     }
     return false;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RegexPredicateEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RegexPredicateEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RegexPredicateEval.java
index 7519e2d..9e9c748 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RegexPredicateEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RegexPredicateEval.java
@@ -47,6 +47,31 @@ public class RegexPredicateEval extends PatternMatchPredicateEval {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((operator == null) ? 0 : operator.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (!super.equals(obj))
+      return false;
+    if (getClass() != obj.getClass())
+      return false;
+    RegexPredicateEval other = (RegexPredicateEval) obj;
+    if (operator == null) {
+      if (other.operator != null)
+        return false;
+    } else if (!operator.equals(other.operator))
+      return false;
+    return true;
+  }
+
+  @Override
   public String toString() {
     return leftExpr.toString() + operator + "'" + pattern +"'";
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
index 4a97e67..a581700 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo.plan.expr;
 
+import java.util.Arrays;
+
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.datum.Datum;
@@ -66,6 +69,14 @@ public class RowConstantEval extends EvalNode {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + Arrays.hashCode(values);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof RowConstantEval) {
       RowConstantEval other = (RowConstantEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/WindowFunctionEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/WindowFunctionEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/WindowFunctionEval.java
index 0ff5927..1a1f138 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/WindowFunctionEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/WindowFunctionEval.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo.plan.expr;
 
+import java.util.Arrays;
+
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.FunctionDesc;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
@@ -86,6 +89,17 @@ public class WindowFunctionEval extends AggregationFunctionCallEval implements C
     return funcDesc.getReturnType();
   }
 
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((params == null) ? 0 : params.hashCode());
+    result = prime * result + Arrays.hashCode(sortSpecs);
+    result = prime * result + ((windowFrame == null) ? 0 : windowFrame.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof WindowFunctionEval) {
       WindowFunctionEval other = (WindowFunctionEval) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/joinorder/GreedyHeuristicJoinOrderAlgorithm.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/joinorder/GreedyHeuristicJoinOrderAlgorithm.java b/tajo-plan/src/main/java/org/apache/tajo/plan/joinorder/GreedyHeuristicJoinOrderAlgorithm.java
index 4231484..e4d6122 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/joinorder/GreedyHeuristicJoinOrderAlgorithm.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/joinorder/GreedyHeuristicJoinOrderAlgorithm.java
@@ -36,7 +36,7 @@ import java.util.*;
  * all join operators.
  */
 public class GreedyHeuristicJoinOrderAlgorithm implements JoinOrderAlgorithm {
-  public static double DEFAULT_SELECTION_FACTOR = 0.1;
+  public static final double DEFAULT_SELECTION_FACTOR = 0.1;
 
   @Override
   public FoundJoinOrder findBestOrder(LogicalPlan plan, LogicalPlan.QueryBlock block, JoinGraph joinGraph,
@@ -89,6 +89,8 @@ public class GreedyHeuristicJoinOrderAlgorithm implements JoinOrderAlgorithm {
                 checkingRelations.add(relation);
               }
               break;
+            default:
+              break;
           }
         }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java
index e926dce..69cff54 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/AlterTableNode.java
@@ -20,6 +20,7 @@ package org.apache.tajo.plan.logical;
 
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.algebra.AlterTableOpType;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.plan.PlanString;
@@ -107,6 +108,19 @@ public class AlterTableNode extends LogicalNode {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((addNewColumn == null) ? 0 : addNewColumn.hashCode());
+    result = prime * result + ((alterTableOpType == null) ? 0 : alterTableOpType.hashCode());
+    result = prime * result + ((columnName == null) ? 0 : columnName.hashCode());
+    result = prime * result + ((newColumnName == null) ? 0 : newColumnName.hashCode());
+    result = prime * result + ((newTableName == null) ? 0 : newTableName.hashCode());
+    result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof AlterTableNode) {
       AlterTableNode other = (AlterTableNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/DistinctGroupbyNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/DistinctGroupbyNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/DistinctGroupbyNode.java
index a40ad59..61ce789 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/DistinctGroupbyNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/DistinctGroupbyNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.util.PlannerUtil;
@@ -27,6 +28,7 @@ import org.apache.tajo.plan.expr.AggregationFunctionCallEval;
 import org.apache.tajo.util.TUtil;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 public class DistinctGroupbyNode extends UnaryNode implements Projectable, Cloneable {
@@ -147,7 +149,7 @@ public class DistinctGroupbyNode extends UnaryNode implements Projectable, Clone
 
   public String toString() {
     StringBuilder sb = new StringBuilder("Distinct GroupBy (");
-    if (groupingColumns != null || groupingColumns.length > 0) {
+    if (groupingColumns != null && groupingColumns.length > 0) {
       sb.append("grouping set=").append(TUtil.arrayToString(groupingColumns));
       sb.append(", ");
     }
@@ -159,6 +161,19 @@ public class DistinctGroupbyNode extends UnaryNode implements Projectable, Clone
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + Arrays.hashCode(aggrFunctions);
+    result = prime * result + ((groupbyPlan == null) ? 0 : groupbyPlan.hashCode());
+    result = prime * result + Arrays.hashCode(groupingColumns);
+    result = prime * result + Arrays.hashCode(resultColumnIds);
+    result = prime * result + ((subGroupbyPlan == null) ? 0 : subGroupbyPlan.hashCode());
+    result = prime * result + Arrays.hashCode(targets);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof DistinctGroupbyNode) {
       DistinctGroupbyNode other = (DistinctGroupbyNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/EvalExprNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/EvalExprNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/EvalExprNode.java
index 0f96575..3aaf5d0 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/EvalExprNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/EvalExprNode.java
@@ -21,7 +21,10 @@
  */
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.util.PlannerUtil;
 import org.apache.tajo.plan.Target;
@@ -69,9 +72,18 @@ public class EvalExprNode extends LogicalNode implements Projectable {
     return "EvalExprNode (" + TUtil.arrayToString(exprs) + ")";
   }
 
-  public boolean equals(Object object) {
-    if (object instanceof EvalExprNode) {
-      EvalExprNode other = (EvalExprNode) object;
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + Arrays.hashCode(exprs);
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof EvalExprNode) {
+      EvalExprNode other = (EvalExprNode) obj;
       return TUtil.checkEquals(this.exprs, other.exprs);
     } else {
       return false;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/GroupbyNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/GroupbyNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/GroupbyNode.java
index 4a18cb4..730f705 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/GroupbyNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/GroupbyNode.java
@@ -18,8 +18,11 @@
 
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.util.PlannerUtil;
@@ -106,7 +109,7 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
   
   public String toString() {
     StringBuilder sb = new StringBuilder("GroupBy (");
-    if (groupingKeys != null || groupingKeys.length > 0) {
+    if (groupingKeys != null && groupingKeys.length > 0) {
       sb.append("grouping set=").append(TUtil.arrayToString(groupingKeys));
       sb.append(", ");
     }
@@ -118,6 +121,17 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
   }
   
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + Arrays.hashCode(aggrFunctions);
+    result = prime * result + Arrays.hashCode(groupingKeys);
+    result = prime * result + (hasDistinct ? 1231 : 1237);
+    result = prime * result + Arrays.hashCode(targets);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof GroupbyNode) {
       GroupbyNode other = (GroupbyNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/HavingNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/HavingNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/HavingNode.java
index a3371c7..a45fbe4 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/HavingNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/HavingNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.expr.EvalNode;
 
@@ -43,6 +44,14 @@ public class HavingNode extends UnaryNode implements SelectableNode, Cloneable {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((qual == null) ? 0 : qual.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof HavingNode) {
       HavingNode other = (HavingNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/IndexScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/IndexScanNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/IndexScanNode.java
index 0d59733..8b73756 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/IndexScanNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/IndexScanNode.java
@@ -18,8 +18,11 @@
 
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.gson.Gson;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.datum.Datum;
@@ -78,6 +81,16 @@ public class IndexScanNode extends ScanNode {
   }
   
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + Arrays.hashCode(datum);
+    result = prime * result + ((keySchema == null) ? 0 : keySchema.hashCode());
+    result = prime * result + Arrays.hashCode(sortKeys);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof IndexScanNode) {
       IndexScanNode other = (IndexScanNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/InsertNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/InsertNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/InsertNode.java
index 769cb59..ee15951 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/InsertNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/InsertNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableDesc;
@@ -124,6 +125,18 @@ public class InsertNode extends StoreTableNode implements Cloneable {
   }
   
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (overwrite ? 1231 : 1237);
+    result = prime * result + ((path == null) ? 0 : path.hashCode());
+    result = prime * result + ((projectedSchema == null) ? 0 : projectedSchema.hashCode());
+    result = prime * result + ((tableSchema == null) ? 0 : tableSchema.hashCode());
+    result = prime * result + ((targetSchema == null) ? 0 : targetSchema.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof InsertNode) {
       InsertNode other = (InsertNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
index 58dfac2..bad8704 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
@@ -22,6 +22,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.algebra.JoinType;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.util.PlannerUtil;
@@ -31,6 +32,7 @@ import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.util.TUtil;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 public class JoinNode extends BinaryNode implements Projectable, Cloneable {
@@ -126,6 +128,17 @@ public class JoinNode extends BinaryNode implements Projectable, Cloneable {
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (candidateBroadcast ? 1231 : 1237);
+    result = prime * result + ((joinQual == null) ? 0 : joinQual.hashCode());
+    result = prime * result + ((joinType == null) ? 0 : joinType.hashCode());
+    result = prime * result + Arrays.hashCode(targets);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof JoinNode) {
       JoinNode other = (JoinNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LimitNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LimitNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LimitNode.java
index 7a3431e..96230a1 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LimitNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LimitNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 
 public final class LimitNode extends UnaryNode implements Cloneable {
@@ -41,7 +42,15 @@ public final class LimitNode extends UnaryNode implements Cloneable {
     return new PlanString(this).appendTitle(" " + fetchFirstNum);
   }
   
-  @Override 
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (int) (fetchFirstNum ^ (fetchFirstNum >>> 32));
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof LimitNode) {
       LimitNode other = (LimitNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LogicalNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LogicalNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LogicalNode.java
index 200977b..450d3e0 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LogicalNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/LogicalNode.java
@@ -22,6 +22,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.json.GsonObject;
 import org.apache.tajo.plan.PlanString;
@@ -87,9 +88,23 @@ public abstract class LogicalNode implements Cloneable, GsonObject {
 	}
 	
 	@Override
-	public boolean equals(Object obj) {
-	  if (obj instanceof LogicalNode) {
-	    LogicalNode other = (LogicalNode) obj;
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    long temp;
+    temp = Double.doubleToLongBits(cost);
+    result = prime * result + (int) (temp ^ (temp >>> 32));
+    result = prime * result + ((inputSchema == null) ? 0 : inputSchema.hashCode());
+    result = prime * result + nodeId;
+    result = prime * result + ((outputSchema == null) ? 0 : outputSchema.hashCode());
+    result = prime * result + ((type == null) ? 0 : type.hashCode());
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof LogicalNode) {
+      LogicalNode other = (LogicalNode) obj;
 
       boolean eq = this.type == other.type;
       eq = eq && TUtil.checkEquals(this.inputSchema, other.inputSchema);
@@ -97,9 +112,9 @@ public abstract class LogicalNode implements Cloneable, GsonObject {
       eq = eq && this.cost == other.cost;
 
       return eq;
-	  } else {
-	    return false;
-	  }
+    } else {
+      return false;
+    }
   }
 
   public boolean deepEquals(Object o) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PersistentStoreNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PersistentStoreNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PersistentStoreNode.java
index 420ed7c..556ae7a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PersistentStoreNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PersistentStoreNode.java
@@ -20,6 +20,7 @@ package org.apache.tajo.plan.logical;
 
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.TUtil;
@@ -68,6 +69,15 @@ public abstract class PersistentStoreNode extends UnaryNode implements Cloneable
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = super.hashCode();
+    result = prime * result + ((options == null) ? 0 : options.hashCode());
+    result = prime * result + ((storageType == null) ? 0 : storageType.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof PersistentStoreNode) {
       PersistentStoreNode other = (PersistentStoreNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ProjectionNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ProjectionNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ProjectionNode.java
index c0b5953..3c9d497 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ProjectionNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ProjectionNode.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.util.PlannerUtil;
 import org.apache.tajo.plan.Target;
@@ -73,17 +76,26 @@ public class ProjectionNode extends UnaryNode implements Projectable {
 	}
 	
 	@Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (distinct ? 1231 : 1237);
+    result = prime * result + Arrays.hashCode(targets);
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
-	  if (obj instanceof ProjectionNode) {
-	    ProjectionNode other = (ProjectionNode) obj;
-	    
-	    boolean b1 = super.equals(other);
+    if (obj instanceof ProjectionNode) {
+      ProjectionNode other = (ProjectionNode) obj;
+      
+      boolean b1 = super.equals(other);
       boolean b2 = TUtil.checkEquals(targets, other.targets);
       return b1 && b2;
-	  } else {
-	    return false;
-	  }
-	}
+    } else {
+      return false;
+    }
+  }
 
 	@Override
   public Object clone() throws CloneNotSupportedException {

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SelectionNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SelectionNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SelectionNode.java
index 4c4d5ee..3897ee2 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SelectionNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SelectionNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.expr.EvalNode;
 
@@ -50,6 +51,14 @@ public class SelectionNode extends UnaryNode implements SelectableNode, Cloneabl
   }
 
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((qual == null) ? 0 : qual.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof SelectionNode) {
       SelectionNode other = (SelectionNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ShuffleFileWriteNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ShuffleFileWriteNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ShuffleFileWriteNode.java
index 29aefc9..8215f51 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ShuffleFileWriteNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ShuffleFileWriteNode.java
@@ -18,8 +18,11 @@
 
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.util.TUtil;
 
@@ -67,6 +70,16 @@ public class ShuffleFileWriteNode extends PersistentStoreNode implements Cloneab
   }
   
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + numOutputs;
+    result = prime * result + Arrays.hashCode(shuffleKeys);
+    result = prime * result + ((shuffleType == null) ? 0 : shuffleType.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof ShuffleFileWriteNode) {
       ShuffleFileWriteNode other = (ShuffleFileWriteNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SortNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SortNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SortNode.java
index 2e5e159..5157d45 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SortNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/SortNode.java
@@ -18,8 +18,11 @@
 
 package org.apache.tajo.plan.logical;
 
+import java.util.Arrays;
+
 import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.util.TUtil;
@@ -46,7 +49,16 @@ public final class SortNode extends UnaryNode implements Cloneable {
     return this.sortKeys;
   }
   
-  @Override 
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + Arrays.hashCode(sortKeys);
+    result = prime * result + ((sortPurpose == null) ? 0 : sortPurpose.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof SortNode) {
       SortNode other = (SortNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/logical/StoreTableNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/StoreTableNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/StoreTableNode.java
index 730eb35..62f7db4 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/StoreTableNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/StoreTableNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.util.TUtil;
@@ -78,6 +79,15 @@ public class StoreTableNode extends PersistentStoreNode implements Cloneable {
   }
   
   @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((partitionDesc == null) ? 0 : partitionDesc.hashCode());
+    result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
+    return result;
+  }
+
+  @Override
   public boolean equals(Object obj) {
     if (obj instanceof StoreTableNode) {
       StoreTableNode other = (StoreTableNode) obj;

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java
index 44d3263..2c55c81 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java
@@ -42,7 +42,7 @@ import java.util.Map;
  */
 public abstract class NameResolver {
 
-  public static Map<NameResolvingMode, NameResolver> resolverMap = Maps.newHashMap();
+  public static final Map<NameResolvingMode, NameResolver> resolverMap = Maps.newHashMap();
 
   static {
     resolverMap.put(NameResolvingMode.RELS_ONLY, new ResolverByRels());
@@ -115,7 +115,7 @@ public abstract class NameResolver {
 
       // If we cannot find any relation against a qualified column name
       if (relationOp == null) {
-        throw null;
+        throw new PlanningException("Cannot find any relation for " + qualifier);
       }
 
       // Please consider a query case:

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
index d7cd82e..4cd008a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
@@ -920,13 +920,15 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<FilterPushDownCo
 
   private void errorFilterPushDown(LogicalPlan plan, LogicalNode node,
                                    FilterPushDownContext context) throws PlanningException {
-    String notMatchedNodeStr = "";
     String prefix = "";
+    StringBuilder notMatchedNodeStrBuilder = new StringBuilder();
     for (EvalNode notMatchedNode: context.pushingDownFilters) {
-      notMatchedNodeStr += prefix + notMatchedNode;
-      prefix = ", ";
+      notMatchedNodeStrBuilder.append(prefix).append(notMatchedNode.toString());
+      if (prefix.isEmpty()) {
+        prefix = ", ";
+      }
     }
-    throw new PlanningException("FilterPushDown failed cause some filters not matched: " + notMatchedNodeStr + "\n" +
+    throw new PlanningException("FilterPushDown failed cause some filters not matched: " + notMatchedNodeStrBuilder.toString() + "\n" +
         "Error node: " + node.getPlanString() + "\n" +
         plan.toString());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java
index 322c8db..5a96054 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeDeserializer.java
@@ -20,6 +20,7 @@ package org.apache.tajo.plan.serder;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+
 import org.apache.tajo.OverridableConf;
 import org.apache.tajo.algebra.WindowSpec.WindowFrameEndBoundType;
 import org.apache.tajo.algebra.WindowSpec.WindowFrameStartBoundType;
@@ -28,6 +29,8 @@ import org.apache.tajo.catalog.FunctionDesc;
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.catalog.exception.NoSuchFunctionException;
 import org.apache.tajo.catalog.proto.CatalogProtos;
+import org.apache.tajo.catalog.proto.CatalogProtos.FunctionSignatureProto;
+import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.datum.*;
 import org.apache.tajo.exception.InternalException;
 import org.apache.tajo.plan.expr.*;
@@ -210,7 +213,19 @@ public class EvalNodeDeserializer {
             }
           }
         } catch (ClassNotFoundException cnfe) {
-          throw new NoSuchFunctionException(funcDesc.getFunctionName(), funcDesc.getParamTypes());
+          String functionName = "Unknown";
+          DataType[] parameterTypes = new DataType[0];
+          if (funcProto.getFuncion() != null && funcProto.getFuncion().getSignature() != null) {
+            FunctionSignatureProto funcSignatureProto = funcProto.getFuncion().getSignature();
+            
+            if (funcSignatureProto.hasName()) {
+              functionName = funcSignatureProto.getName();
+            }
+            
+            parameterTypes = funcSignatureProto.getParameterTypesList().toArray(
+                new DataType[funcSignatureProto.getParameterTypesCount()]);
+          }
+          throw new NoSuchFunctionException(functionName, parameterTypes);
         } catch (InternalException ie) {
           throw new NoSuchFunctionException(funcDesc.getFunctionName(), funcDesc.getParamTypes());
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java
index b6912a7..22b3351 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/LogicalPlanVerifier.java
@@ -34,20 +34,13 @@ import org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor;
 import java.util.Stack;
 
 public class LogicalPlanVerifier extends BasicLogicalPlanVisitor<LogicalPlanVerifier.Context, LogicalNode> {
-  private TajoConf conf;
-  private CatalogService catalog;
-
   public LogicalPlanVerifier(TajoConf conf, CatalogService catalog) {
-    this.conf = conf;
-    this.catalog = catalog;
   }
 
   public static class Context {
-    OverridableConf queryContext;
     VerificationState state;
 
     public Context(OverridableConf queryContext, VerificationState state) {
-      this.queryContext = this.queryContext;
       this.state = state;
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java
index 25452de..275ab3a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/PreLogicalPlanVerifier.java
@@ -83,8 +83,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer
     super.visitProjection(context, stack, expr);
 
     Set<String> names = TUtil.newHashSet();
-    Expr [] distinctValues = null;
-
+    
     for (NamedExpr namedExpr : expr.getNamedExprs()) {
 
       if (namedExpr.hasAlias()) {
@@ -95,22 +94,6 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor<PreLogicalPlanVer
           names.add(namedExpr.getAlias());
         }
       }
-
-      Set<GeneralSetFunctionExpr> exprs = ExprFinder.finds(namedExpr.getExpr(), OpType.GeneralSetFunction);
-
-      // Currently, avg functions with distinct aggregation are not supported.
-      // This code does not allow users to use avg functions with distinct aggregation.
-      if (distinctValues != null) {
-        for (GeneralSetFunctionExpr setFunction : exprs) {
-          if (setFunction.getSignature().equalsIgnoreCase("avg")) {
-            if (setFunction.isDistinct()) {
-              throw new PlanningException("avg(distinct) function is not supported yet.");
-            } else {
-              throw new PlanningException("avg() function with distinct aggregation functions is not supported yet.");
-            }
-          }
-        }
-      }
     }
     return expr;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/154f5b9e/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java
index 23c834d..ecf9050 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/visitor/BasicLogicalPlanVisitor.java
@@ -258,8 +258,8 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi
       LogicalPlan.QueryBlock rightBlock = plan.getBlock(node.getRightChild());
       visit(context, plan, rightBlock, rightBlock.getRoot(), stack);
     } else {
-      result = visit(context, plan, null, node.getLeftChild(), stack);
-      visit(context, plan, null, node.getRightChild(), stack);
+      result = visit(context, null, null, node.getLeftChild(), stack);
+      visit(context, null, null, node.getRightChild(), stack);
     }
 
     stack.pop();
@@ -295,7 +295,7 @@ public class BasicLogicalPlanVisitor<CONTEXT, RESULT> implements LogicalPlanVisi
       LogicalPlan.QueryBlock childBlock = plan.getBlock(node.getSubQuery());
       result = visit(context, plan, childBlock, childBlock.getRoot(), stack);
     } else {
-      result = visit(context, plan, null, node.getSubQuery(), stack);
+      result = visit(context, null, null, node.getSubQuery(), stack);
     }
     stack.pop();
     return result;


Mime
View raw message