tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [13/13] git commit: TAJO-774: Implement logical plan part and physical executor for window function.
Date Wed, 09 Jul 2014 06:21:45 GMT
TAJO-774: Implement logical plan part and physical executor for window function.

Closes #13


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

Branch: refs/heads/master
Commit: d3ee50a95868a17cd69964adbd3f70149040ab6b
Parents: a8bf9a3
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Wed Jul 9 13:11:52 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Wed Jul 9 13:13:45 2014 +0900

----------------------------------------------------------------------
 CHANGES                                         |   7 +-
 .../org/apache/tajo/algebra/Aggregation.java    |  31 +-
 .../org/apache/tajo/algebra/AlterTable.java     |  12 +-
 .../apache/tajo/algebra/AlterTablespace.java    |   9 +
 .../apache/tajo/algebra/BetweenPredicate.java   |  10 +
 .../org/apache/tajo/algebra/BinaryOperator.java |   8 +
 .../apache/tajo/algebra/CaseWhenPredicate.java  |  21 +-
 .../apache/tajo/algebra/ColumnDefinition.java   |  19 +-
 .../tajo/algebra/ColumnReferenceExpr.java       |   8 +
 .../org/apache/tajo/algebra/CreateDatabase.java |   9 +
 .../org/apache/tajo/algebra/CreateTable.java    | 134 ++++++-
 .../org/apache/tajo/algebra/DataTypeExpr.java   |   9 +
 .../org/apache/tajo/algebra/DateLiteral.java    |   7 +
 .../java/org/apache/tajo/algebra/DateValue.java |  11 +-
 .../org/apache/tajo/algebra/DropDatabase.java   |   8 +
 .../java/org/apache/tajo/algebra/DropTable.java |  14 +-
 .../apache/tajo/algebra/ExistsPredicate.java    |   7 +
 .../main/java/org/apache/tajo/algebra/Expr.java |   9 +-
 .../org/apache/tajo/algebra/FunctionExpr.java   |  13 +
 .../tajo/algebra/GeneralSetFunctionExpr.java    |   8 +-
 .../java/org/apache/tajo/algebra/Having.java    |   7 +
 .../org/apache/tajo/algebra/InPredicate.java    |   7 +
 .../java/org/apache/tajo/algebra/Insert.java    |  14 +
 .../apache/tajo/algebra/IsNullPredicate.java    |   9 +-
 .../main/java/org/apache/tajo/algebra/Join.java |  15 +
 .../java/org/apache/tajo/algebra/Limit.java     |   7 +
 .../org/apache/tajo/algebra/LiteralValue.java   |   8 +
 .../java/org/apache/tajo/algebra/NamedExpr.java |   7 +
 .../java/org/apache/tajo/algebra/OpType.java    |  40 +-
 .../tajo/algebra/PatternMatchPredicate.java     |   8 +
 .../org/apache/tajo/algebra/Projection.java     |   8 +-
 .../tajo/algebra/QualifiedAsteriskExpr.java     |   7 +
 .../java/org/apache/tajo/algebra/Relation.java  |   8 +
 .../org/apache/tajo/algebra/RelationList.java   |  10 +
 .../java/org/apache/tajo/algebra/Selection.java |   7 +
 .../org/apache/tajo/algebra/SetOperation.java   |   7 +
 .../org/apache/tajo/algebra/SignedExpr.java     |   7 +
 .../main/java/org/apache/tajo/algebra/Sort.java |  25 +-
 .../tajo/algebra/TablePrimarySubQuery.java      |  10 +
 .../org/apache/tajo/algebra/TimeLiteral.java    |   7 +
 .../java/org/apache/tajo/algebra/TimeValue.java |  12 +-
 .../apache/tajo/algebra/TimestampLiteral.java   |  10 +-
 .../org/apache/tajo/algebra/UnaryOperator.java  |   7 +
 .../org/apache/tajo/algebra/ValueListExpr.java  |  10 +
 .../java/org/apache/tajo/algebra/Window.java    |   6 +-
 .../apache/tajo/algebra/WindowFunctionExpr.java |  19 +-
 .../org/apache/tajo/algebra/WindowSpec.java     | 242 ++++++++++++
 .../org/apache/tajo/algebra/WindowSpecExpr.java | 181 ---------
 .../exception/NoSuchFunctionException.java      |   4 +
 .../src/main/proto/CatalogProtos.proto          |   8 +-
 .../eval/AggregationFunctionCallEval.java       |   5 +
 .../apache/tajo/engine/eval/AlgebraicUtil.java  |  19 +-
 .../tajo/engine/eval/BasicEvalNodeVisitor.java  |   8 +
 .../org/apache/tajo/engine/eval/BinaryEval.java |  99 +----
 .../tajo/engine/eval/EvalNodeVisitor2.java      |   1 +
 .../org/apache/tajo/engine/eval/EvalType.java   |   1 +
 .../apache/tajo/engine/eval/FunctionEval.java   |  32 +-
 .../tajo/engine/eval/SimpleEvalNodeVisitor.java |  13 +-
 .../tajo/engine/eval/WindowFunctionEval.java    | 117 ++++++
 .../tajo/engine/function/WindowAggFunc.java     |  62 +++
 .../tajo/engine/function/window/Rank.java       |  90 +++++
 .../tajo/engine/function/window/RowNumber.java  |  67 ++++
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |  40 +-
 .../tajo/engine/planner/AlgebraVisitor.java     |   7 +-
 .../tajo/engine/planner/BaseAlgebraVisitor.java |  37 ++
 .../engine/planner/BasicLogicalPlanVisitor.java |  11 +
 .../planner/ExplainLogicalPlanVisitor.java      |   5 +
 .../tajo/engine/planner/ExprAnnotator.java      | 125 ++++++-
 .../tajo/engine/planner/ExprNormalizer.java     |  92 ++++-
 .../apache/tajo/engine/planner/LogicalPlan.java |  20 +-
 .../engine/planner/LogicalPlanPreprocessor.java |  23 +-
 .../tajo/engine/planner/LogicalPlanVisitor.java |   3 +-
 .../tajo/engine/planner/LogicalPlanner.java     | 375 ++++++++++++++++---
 .../engine/planner/PhysicalPlannerImpl.java     |  29 +-
 .../apache/tajo/engine/planner/PlannerUtil.java |  14 +-
 .../engine/planner/SimpleAlgebraVisitor.java    |  17 +-
 .../tajo/engine/planner/TypeDeterminant.java    | 301 +++++++++++++++
 .../engine/planner/global/GlobalPlanner.java    |  55 ++-
 .../tajo/engine/planner/logical/NodeType.java   |   1 +
 .../engine/planner/logical/WindowAggNode.java   | 238 ++++++++++++
 .../tajo/engine/planner/logical/WindowSpec.java | 208 ++++++++++
 .../engine/planner/physical/WindowAggExec.java  | 340 +++++++++++++++++
 .../planner/rewrite/FilterPushDownRule.java     |  56 ++-
 .../planner/rewrite/ProjectionPushDownRule.java |  93 +++++
 .../apache/tajo/engine/utils/DataTypeUtil.java  | 121 ++++++
 .../org/apache/tajo/master/GlobalEngine.java    |   1 +
 .../tajo/engine/parser/TestSQLAnalyzer.java     |   2 +-
 .../tajo/engine/query/TestGroupByQuery.java     |   2 +-
 .../tajo/engine/query/TestWindowQuery.java      | 240 ++++++++++++
 .../queries/TestLogicalPlanner/window1.sql      |   5 +
 .../queries/TestSQLAnalyzer/window1.sql         |   5 +
 .../queries/TestSQLAnalyzer/window2.sql         |   5 +
 .../queries/TestSQLAnalyzer/window3.sql         |   5 +
 .../queries/TestSQLAnalyzer/window4.sql         |   5 +
 .../queries/TestSQLAnalyzer/window5.sql         |   6 +
 .../queries/TestSQLAnalyzer/window6.sql         |   6 +
 .../queries/TestSQLAnalyzer/window7.sql         |   6 +
 .../queries/TestSQLAnalyzer/window8.sql         |   6 +
 .../queries/TestSQLAnalyzer/window9.sql         |   9 +
 .../queries/TestWindowQuery/rowNumber1.sql      |   5 +
 .../queries/TestWindowQuery/rowNumber2.sql      |   5 +
 .../queries/TestWindowQuery/rowNumber3.sql      |   7 +
 .../TestWindowQuery/testComplexOrderBy1.sql     |   5 +
 .../queries/TestWindowQuery/testWindow1.sql     |   1 +
 .../queries/TestWindowQuery/testWindow2.sql     |   1 +
 .../queries/TestWindowQuery/testWindow3.sql     |   1 +
 .../queries/TestWindowQuery/testWindow4.sql     |   1 +
 .../queries/TestWindowQuery/testWindow5.sql     |   1 +
 .../queries/TestWindowQuery/testWindow6.sql     |   1 +
 .../queries/TestWindowQuery/testWindow7.sql     |   1 +
 .../TestWindowQuery/testWindowBeforeLimit.sql   |   6 +
 .../testWindowWithAggregation1.sql              |   4 +
 .../testWindowWithAggregation2.sql              |   7 +
 .../testWindowWithAggregation3.sql              |   5 +
 .../testWindowWithAggregation4.sql              |   8 +
 .../testWindowWithAggregation5.sql              |   9 +
 .../testWindowWithAggregation6.sql              |  10 +
 .../TestWindowQuery/testWindowWithOrderBy1.sql  |   6 +
 .../TestWindowQuery/testWindowWithOrderBy2.sql  |   6 +
 .../TestWindowQuery/testWindowWithOrderBy3.sql  |   6 +
 .../TestWindowQuery/testWindowWithOrderBy4.sql  |   7 +
 .../TestWindowQuery/testWindowWithOrderBy5.sql  |   9 +
 .../TestWindowQuery/testWindowWithSubQuery.sql  |  14 +
 .../TestWindowQuery/testWindowWithSubQuery2.sql |  15 +
 .../TestWindowQuery/testWindowWithSubQuery3.sql |  14 +
 .../TestWindowQuery/testWindowWithSubQuery4.sql |  14 +
 .../TestWindowQuery/testWindowWithSubQuery5.sql |  11 +
 .../TestWindowQuery/testWindowWithSubQuery6.sql |   9 +
 .../results/TestSQLAnalyzer/window1.result      |  37 ++
 .../results/TestSQLAnalyzer/window2.result      |  44 +++
 .../results/TestSQLAnalyzer/window3.result      |  50 +++
 .../results/TestSQLAnalyzer/window4.result      |  48 +++
 .../results/TestSQLAnalyzer/window5.result      |  77 ++++
 .../results/TestSQLAnalyzer/window6.result      |  83 ++++
 .../results/TestSQLAnalyzer/window7.result      |  81 ++++
 .../results/TestSQLAnalyzer/window8.result      |  86 +++++
 .../results/TestSQLAnalyzer/window9.result      |  56 +++
 .../TestSelectQuery/testSumFloatOverflow.result |   2 +-
 .../TestSelectQuery/testSumIntOverflow.result   |   2 +-
 .../results/TestWindowQuery/rowNumber1.result   |   7 +
 .../results/TestWindowQuery/rowNumber2.result   |   7 +
 .../results/TestWindowQuery/rowNumber3.result   |   7 +
 .../TestWindowQuery/testComplexOrderBy1.result  |   7 +
 .../results/TestWindowQuery/testWindow1.result  |   7 +
 .../results/TestWindowQuery/testWindow2.result  |   7 +
 .../results/TestWindowQuery/testWindow3.result  |   7 +
 .../results/TestWindowQuery/testWindow4.result  |   7 +
 .../results/TestWindowQuery/testWindow5.result  |   7 +
 .../results/TestWindowQuery/testWindow6.result  |   7 +
 .../results/TestWindowQuery/testWindow7.result  |   7 +
 .../testWindowBeforeLimit.result                |   5 +
 .../testWindowWithAggregation1.result           |   3 +
 .../testWindowWithAggregation2.result           |   5 +
 .../testWindowWithAggregation3.result           |   3 +
 .../testWindowWithAggregation4.result           |   5 +
 .../testWindowWithAggregation5.result           |   5 +
 .../testWindowWithAggregation6.result           |   5 +
 .../testWindowWithOrderBy1.result               |   7 +
 .../testWindowWithOrderBy2.result               |   7 +
 .../testWindowWithOrderBy3.result               |   7 +
 .../testWindowWithOrderBy4.result               |   7 +
 .../testWindowWithOrderBy5.result               |   7 +
 .../testWindowWithSubQuery.result               |   7 +
 .../testWindowWithSubQuery2.result              |   5 +
 .../testWindowWithSubQuery3.result              |   7 +
 .../testWindowWithSubQuery4.result              |   7 +
 .../testWindowWithSubQuery5.result              |   5 +
 .../testWindowWithSubQuery6.result              |   3 +
 .../queries/TestSQLAnalyzer/window1.sql         |   5 -
 .../queries/TestSQLAnalyzer/window2.sql         |   5 -
 .../queries/TestSQLAnalyzer/window3.sql         |   5 -
 .../queries/TestSQLAnalyzer/window4.sql         |   5 -
 .../queries/TestSQLAnalyzer/window5.sql         |   6 -
 .../queries/TestSQLAnalyzer/window6.sql         |   6 -
 .../queries/TestSQLAnalyzer/window7.sql         |   6 -
 .../queries/TestSQLAnalyzer/window8.sql         |   6 -
 .../queries/TestSQLAnalyzer/window9.sql         |   9 -
 .../results/TestSQLAnalyzer/window1.result      |  42 ---
 .../results/TestSQLAnalyzer/window2.result      |  48 ---
 .../results/TestSQLAnalyzer/window3.result      |  54 ---
 .../results/TestSQLAnalyzer/window4.result      |  52 ---
 .../results/TestSQLAnalyzer/window5.result      |  81 ----
 .../results/TestSQLAnalyzer/window6.result      |  87 -----
 .../results/TestSQLAnalyzer/window7.result      |  85 -----
 .../results/TestSQLAnalyzer/window8.result      |  90 -----
 .../results/TestSQLAnalyzer/window9.result      | 118 ------
 .../storage/BinarySerializerDeserializer.java   |   2 +-
 187 files changed, 4520 insertions(+), 1223 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3dd67a9..055b3c9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@ Release 0.9.0 - unreleased
 
   NEW FEATURES 
 
+    TAJO-774: Implement logical plan part and physical executor for window 
+    function. (hyunsik)
+
     TAJO-847: Supporting MariaDB-based Store, which is compatible with MySQL.
     (Jinhang Choi via jihoon)
 
@@ -68,10 +71,6 @@ Release 0.9.0 - unreleased
     TAJO-789: Improve shuffle URI. (jinho)
 
     TAJO-769: A minor improvements for HCatalogStore (Fengdong Yu via hyunsik)
-    
-  SUB TASKS:
-
-    TAJO-757: Add parser rule and algebraic expression for window function. (hyunsik)
 
     TAJO-734: Arrange TajoCli output message. (hyoungjunkim via jihoon)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Aggregation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Aggregation.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Aggregation.java
index bf95e89..edb523b 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Aggregation.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Aggregation.java
@@ -67,7 +67,23 @@ public class Aggregation extends UnaryOperator {
     return a && b;
   }
 
-  public static class GroupElement implements JsonSerializable {
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Aggregation aggregation = (Aggregation) super.clone();
+
+    aggregation.namedExprs = new NamedExpr[namedExprs.length];
+    for (int i = 0; i < namedExprs.length; i++) {
+      aggregation.namedExprs[i] = (NamedExpr) namedExprs[i].clone();
+    }
+
+    aggregation.groups = new GroupElement[groups.length];
+    for (int i = 0; i < groups.length; i++) {
+      aggregation.groups[i] = (GroupElement) groups[i].clone();
+    }
+    return aggregation;
+  }
+
+  public static class GroupElement implements JsonSerializable, Cloneable {
     @Expose @SerializedName("GroupType")
     private GroupType group_type;
     @Expose @SerializedName("Dimensions")
@@ -110,6 +126,19 @@ public class Aggregation extends UnaryOperator {
 
       return false;
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      GroupElement element = (GroupElement) super.clone();
+      element.group_type = group_type;
+      if (element.grouping_sets != null) {
+        element.grouping_sets = new Expr[grouping_sets.length];
+        for (int i = 0; i < grouping_sets.length; i++) {
+          element.grouping_sets[i] = (Expr) grouping_sets[i].clone();
+        }
+      }
+      return element;
+    }
   }
 
   public static enum GroupType {

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTable.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTable.java
index 0f56bc2..6d72472 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTable.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTable.java
@@ -115,5 +115,15 @@ public class AlterTable extends Expr {
         TUtil.checkEquals(alterTableOpType, another.alterTableOpType);
   }
 
-
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    AlterTable alter = (AlterTable) super.clone();
+    alter.tableName = tableName;
+    alter.newTableName = newTableName;
+    alter.columnName = columnName;
+    alter.newColumnName = newColumnName;
+    alter.addNewColumn = (ColumnDefinition) addNewColumn.clone();
+    alter.alterTableOpType = alterTableOpType;
+    return alter;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTablespace.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTablespace.java
index b9cb0c7..b17b53e 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTablespace.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/AlterTablespace.java
@@ -68,4 +68,13 @@ public class AlterTablespace extends Expr {
         TUtil.checkEquals(setType, another.setType) &&
         TUtil.checkEquals(uri, another.uri);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    AlterTablespace alter = (AlterTablespace) super.clone();
+    alter.setType = setType;
+    alter.tablespaceName = tablespaceName;
+    alter.uri = uri;
+    return alter;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/BetweenPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/BetweenPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/BetweenPredicate.java
index 4d4f09e..4b17bdb 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/BetweenPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/BetweenPredicate.java
@@ -75,4 +75,14 @@ public class BetweenPredicate extends Expr {
     return symmetric == another.symmetric && predicand.equals(another.predicand) && begin.equals(another.begin) &&
         end.equals(another.end);
   }
+
+  public Object clone() throws CloneNotSupportedException {
+    BetweenPredicate between = (BetweenPredicate) super.clone();
+    between.not = not;
+    between.symmetric = symmetric;
+    between.predicand = (Expr) predicand.clone();
+    between.begin = (Expr) between.clone();
+    between.end = (Expr) end.clone();
+    return between;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/BinaryOperator.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/BinaryOperator.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/BinaryOperator.java
index 0cc6376..4ca3788 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/BinaryOperator.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/BinaryOperator.java
@@ -67,4 +67,12 @@ public class BinaryOperator extends Expr {
   public String toString() {
     return left.toString() + " " + opType.toString() + " " + right.toString();
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    BinaryOperator binaryOperator = (BinaryOperator) super.clone();
+    binaryOperator.left = (Expr) left.clone();
+    binaryOperator.right = (Expr) right.clone();
+    return binaryOperator;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/CaseWhenPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CaseWhenPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CaseWhenPredicate.java
index 41eba6e..8e97c31 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CaseWhenPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CaseWhenPredicate.java
@@ -69,11 +69,22 @@ public class CaseWhenPredicate extends Expr {
   }
 
   @Override
+  public Object clone() throws CloneNotSupportedException {
+    CaseWhenPredicate caseWhen = (CaseWhenPredicate) super.clone();
+    caseWhen.whens = new ArrayList<WhenExpr>();
+    for (int i = 0; i < whens.size(); i++) {
+      caseWhen.whens.add((WhenExpr) whens.get(i).clone());
+    }
+    caseWhen.elseResult = elseResult != null ? (Expr) elseResult.clone() : null;
+    return caseWhen;
+  }
+
+  @Override
   public String toJson() {
     return JsonHelper.toJson(this);
   }
 
-  public static class WhenExpr {
+  public static class WhenExpr implements Cloneable {
     @Expose @SerializedName("Condition")
     Expr condition;
     @Expose @SerializedName("Result")
@@ -112,5 +123,13 @@ public class CaseWhenPredicate extends Expr {
 
       return false;
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      WhenExpr when = (WhenExpr) super.clone();
+      when.condition = (Expr) condition.clone();
+      when.result = (Expr) result.clone();
+      return when;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnDefinition.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnDefinition.java
index c20d409..e6e05d4 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnDefinition.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnDefinition.java
@@ -22,11 +22,11 @@ import com.google.gson.annotations.SerializedName;
 
 public  class ColumnDefinition extends DataTypeExpr {
   @Expose @SerializedName("ColumnDefName")
-  String col_name;
+  String columnName;
 
   public ColumnDefinition(String columnName, String dataType) {
     super(dataType);
-    this.col_name = columnName;
+    this.columnName = columnName;
   }
 
   public ColumnDefinition(String columnName, DataTypeExpr dataType) {
@@ -37,17 +37,17 @@ public  class ColumnDefinition extends DataTypeExpr {
         setScale(dataType.scale);
       }
     }
-    this.col_name = columnName;
+    this.columnName = columnName;
   }
 
   public String getColumnName() {
-    return this.col_name;
+    return this.columnName;
   }
 
   @Override
   public int hashCode() {
     int hash = super.hashCode();
-    return hash * 89 * col_name.hashCode();
+    return hash * 89 * columnName.hashCode();
 
   }
 
@@ -55,9 +55,16 @@ public  class ColumnDefinition extends DataTypeExpr {
   public boolean equalsTo(Expr expr) {
     if (expr instanceof ColumnDefinition) {
       ColumnDefinition another = (ColumnDefinition) expr;
-      return col_name.equals(another.col_name) && super.equalsTo(another);
+      return columnName.equals(another.columnName) && super.equalsTo(another);
     }
 
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    ColumnDefinition column = (ColumnDefinition) super.clone();
+    column.columnName = columnName;
+    return column;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
index 97bf332..456b570 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ColumnReferenceExpr.java
@@ -91,4 +91,12 @@ public class ColumnReferenceExpr extends Expr {
   public String toString() {
     return qualifier != null ? qualifier + "." + name : name;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    ColumnReferenceExpr column = (ColumnReferenceExpr) super.clone();
+    column.qualifier = qualifier;
+    column.name = name;
+    return column;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateDatabase.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateDatabase.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateDatabase.java
index 2ff0ce7..1144b6e 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateDatabase.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateDatabase.java
@@ -83,4 +83,13 @@ public class CreateDatabase extends Expr {
         ifNotExists == another.ifNotExists;
 
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    CreateDatabase createDb = (CreateDatabase) super.clone();
+    createDb.databaseName = databaseName;
+    createDb.tablespaceName = tablespaceName;
+    createDb.ifNotExists = ifNotExists;
+    return createDb;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java
index c74677d..bd04a91 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/CreateTable.java
@@ -24,6 +24,8 @@ import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 import org.apache.tajo.util.TUtil;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.lang.reflect.Type;
 import java.util.List;
 import java.util.Map;
@@ -179,6 +181,26 @@ public class CreateTable extends Expr {
         ifNotExists == another.ifNotExists;
   }
 
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    CreateTable createTable = (CreateTable) super.clone();
+    createTable.external = external;
+    createTable.tableName = tableName;
+    if (tableElements != null) {
+      createTable.tableElements = new ColumnDefinition[tableElements.length];
+      for (int i = 0; i < tableElements.length; i++) {
+        createTable.tableElements[i] = (ColumnDefinition) tableElements[i].clone();
+      }
+    }
+    createTable.storageType = storageType;
+    createTable.location = location;
+    createTable.subquery = subquery;
+    createTable.params = new HashMap<String, String>(params);
+    createTable.partition = (PartitionMethodDescExpr) partition.clone();
+    createTable.ifNotExists = ifNotExists;
+    return createTable;
+  }
+
   public static enum PartitionType {
     RANGE,
     HASH,
@@ -186,7 +208,7 @@ public class CreateTable extends Expr {
     COLUMN
   }
 
-  public static abstract class PartitionMethodDescExpr {
+  public static abstract class PartitionMethodDescExpr implements Cloneable {
     @Expose @SerializedName("PartitionType")
     PartitionType type;
 
@@ -198,6 +220,13 @@ public class CreateTable extends Expr {
       return type;
     }
 
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      PartitionMethodDescExpr partition = (PartitionMethodDescExpr) super.clone();
+      partition.type = type;
+      return partition;
+    }
+
     static class JsonSerDer implements JsonSerializer<PartitionMethodDescExpr>,
         JsonDeserializer<PartitionMethodDescExpr> {
 
@@ -237,7 +266,7 @@ public class CreateTable extends Expr {
     }
   }
 
-  public static class RangePartition extends PartitionMethodDescExpr {
+  public static class RangePartition extends PartitionMethodDescExpr implements Cloneable {
     @Expose @SerializedName("Columns")
     ColumnReferenceExpr [] columns;
     @Expose @SerializedName("Specifiers")
@@ -270,9 +299,25 @@ public class CreateTable extends Expr {
         return false;
       }
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      RangePartition range = (RangePartition) super.clone();
+      range.columns = new ColumnReferenceExpr[columns.length];
+      for (int i = 0; i < columns.length; i++) {
+        range.columns[i] = (ColumnReferenceExpr) columns[i].clone();
+      }
+      if (range.specifiers != null) {
+        range.specifiers = new ArrayList<RangePartitionSpecifier>();
+        for (int i = 0; i < specifiers.size(); i++) {
+          range.specifiers.add(specifiers.get(i));
+        }
+      }
+      return range;
+    }
   }
 
-  public static class HashPartition extends PartitionMethodDescExpr {
+  public static class HashPartition extends PartitionMethodDescExpr implements Cloneable {
     @Expose @SerializedName("Columns")
     ColumnReferenceExpr [] columns;
     @Expose @SerializedName("Quantity")
@@ -325,6 +370,23 @@ public class CreateTable extends Expr {
         return false;
       }
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      HashPartition hash = (HashPartition) super.clone();
+      hash.columns = new ColumnReferenceExpr[columns.length];
+      for (int i = 0; i < columns.length; i++) {
+        hash.columns[i] = (ColumnReferenceExpr) columns[i].clone();
+      }
+      hash.quantity = quantity;
+      if (specifiers != null) {
+        hash.specifiers = new ArrayList<PartitionSpecifier>();
+        for (PartitionSpecifier specifier : specifiers) {
+          hash.specifiers.add(specifier);
+        }
+      }
+      return hash;
+    }
   }
 
   public static class ListPartition extends PartitionMethodDescExpr {
@@ -360,6 +422,22 @@ public class CreateTable extends Expr {
         return false;
       }
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      ListPartition listPartition = (ListPartition) super.clone();
+      listPartition.columns = new ColumnReferenceExpr[columns.length];
+      for (int i = 0; i < columns.length; i++) {
+        listPartition.columns[i] = (ColumnReferenceExpr) columns[i].clone();
+      }
+      if (specifiers != null) {
+        listPartition.specifiers = new ArrayList<ListPartitionSpecifier>();
+        for (ListPartitionSpecifier specifier : specifiers) {
+          listPartition.specifiers.add(specifier);
+        }
+      }
+      return listPartition;
+    }
   }
 
   public static class ColumnPartition extends PartitionMethodDescExpr {
@@ -368,35 +446,39 @@ public class CreateTable extends Expr {
     @Expose @SerializedName("IsOmitValues")
     private boolean isOmitValues;
 
-    public ColumnPartition(ColumnDefinition [] columns, boolean isOmitValues) {
+    public ColumnPartition(ColumnDefinition [] columns) {
       super(PartitionType.COLUMN);
       this.columns = columns;
-      this.isOmitValues = isOmitValues;
     }
 
     public ColumnDefinition [] getColumns() {
       return columns;
     }
 
-    public boolean isOmitValues() {
-      return isOmitValues;
-    }
-
     public int hashCode() {
-      return Objects.hashCode(Objects.hashCode(columns), isOmitValues);
+      return Objects.hashCode(columns);
     }
 
     public boolean equals(Object object) {
       if (object instanceof ColumnPartition) {
         ColumnPartition another = (ColumnPartition) object;
-        return type == another.type && TUtil.checkEquals(columns, another.columns) &&
-            TUtil.checkEquals(isOmitValues, another.isOmitValues);
+        return type == another.type && TUtil.checkEquals(columns, another.columns);
       }
       return false;
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      ColumnPartition columnPartition = (ColumnPartition) super.clone();
+      columnPartition.columns = new ColumnDefinition[columns.length];
+      for (int i = 0; i < columns.length; i++) {
+        columnPartition.columns[i] = (ColumnDefinition) columns[i].clone();
+      }
+      return columnPartition;
+    }
   }
 
-  public static class RangePartitionSpecifier extends PartitionSpecifier {
+  public static class RangePartitionSpecifier extends PartitionSpecifier implements Cloneable {
     @Expose @SerializedName("End")
     Expr end;
     @Expose @SerializedName("IsMaxValue")
@@ -436,9 +518,17 @@ public class CreateTable extends Expr {
 
       return true;
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      RangePartitionSpecifier specifier = (RangePartitionSpecifier) super.clone();
+      specifier.end = (Expr) end.clone();
+      specifier.maxValue = maxValue;
+      return specifier;
+    }
   }
 
-  public static class ListPartitionSpecifier extends PartitionSpecifier {
+  public static class ListPartitionSpecifier extends PartitionSpecifier implements Cloneable {
     @Expose @SerializedName("ValueList")
     ValueListExpr valueList;
 
@@ -465,9 +555,16 @@ public class CreateTable extends Expr {
 
       return valueList.equals(that.valueList);
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      ListPartitionSpecifier specifier = (ListPartitionSpecifier) super.clone();
+      specifier.valueList = (ValueListExpr) valueList.clone();
+      return specifier;
+    }
   }
 
-  public static class PartitionSpecifier {
+  public static class PartitionSpecifier implements Cloneable {
     @Expose @SerializedName("PartitionSpecName")
     private String name;
 
@@ -490,5 +587,12 @@ public class CreateTable extends Expr {
         return false;
       }
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      PartitionSpecifier specifier = (PartitionSpecifier) super.clone();
+      specifier.name = name;
+      return specifier;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/DataTypeExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DataTypeExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DataTypeExpr.java
index 6978b84..9dc795b 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DataTypeExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DataTypeExpr.java
@@ -76,4 +76,13 @@ public class DataTypeExpr extends Expr {
         TUtil.checkEquals(lengthOrPrecision, another.lengthOrPrecision) &&
         TUtil.checkEquals(scale, another.scale);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    DataTypeExpr dataType = (DataTypeExpr) super.clone();
+    dataType.typeName = typeName;
+    dataType.lengthOrPrecision = lengthOrPrecision;
+    dataType.scale = scale;
+    return dataType;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateLiteral.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateLiteral.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateLiteral.java
index fafa8f8..297a44e 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateLiteral.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateLiteral.java
@@ -51,4 +51,11 @@ public class DateLiteral extends Expr {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    DateLiteral newDate = (DateLiteral) super.clone();
+    newDate.date = date;
+    return newDate;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateValue.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateValue.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateValue.java
index 8424ab4..5878f92 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateValue.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DateValue.java
@@ -22,7 +22,7 @@ import com.google.common.base.Objects;
 import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
-public class DateValue {
+public class DateValue implements Cloneable {
   @Expose @SerializedName("Year")
   private String years;
   @Expose @SerializedName("Month")
@@ -65,4 +65,13 @@ public class DateValue {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    DateValue date = (DateValue) super.clone();
+    date.years = years;
+    date.months = months;
+    date.days = days;
+    return date;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropDatabase.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropDatabase.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropDatabase.java
index fc949fd..e66b59d 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropDatabase.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropDatabase.java
@@ -52,4 +52,12 @@ public class DropDatabase extends Expr {
     DropDatabase another = (DropDatabase) expr;
     return databaseName.equals(another.databaseName) && ifExists == another.ifExists;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    DropDatabase drop = (DropDatabase) super.clone();
+    drop.databaseName = databaseName;
+    drop.ifExists = ifExists;
+    return drop;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropTable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropTable.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropTable.java
index c6e69dc..2c55b7f 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropTable.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/DropTable.java
@@ -24,11 +24,11 @@ import com.google.gson.annotations.SerializedName;
 
 public class DropTable extends Expr {
   @Expose @SerializedName("TableName")
-  private final String tableName;
+  private String tableName;
   @Expose @SerializedName("IfExists")
-  private final boolean ifExists;
+  private boolean ifExists;
   @Expose @SerializedName("IsPurge")
-  private final boolean purge;
+  private boolean purge;
 
   public DropTable(String tableName, boolean ifExists, boolean purge) {
     super(OpType.DropTable);
@@ -64,4 +64,12 @@ public class DropTable extends Expr {
     }
     return false;
   }
+
+  public Object clone() throws CloneNotSupportedException {
+    DropTable drop = (DropTable) super.clone();
+    drop.tableName = tableName;
+    drop.ifExists = ifExists;
+    drop.purge = purge;
+    return drop;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExistsPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExistsPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExistsPredicate.java
index 6bf2ddd..389fd74 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExistsPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExistsPredicate.java
@@ -50,4 +50,11 @@ public class ExistsPredicate extends UnaryOperator {
     ExistsPredicate another = (ExistsPredicate) expr;
     return not == another.not;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    ExistsPredicate exists = (ExistsPredicate) super.clone();
+    exists.not = not;
+    return exists;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Expr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Expr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Expr.java
index 26e0831..76af393 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Expr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Expr.java
@@ -25,7 +25,7 @@ import org.apache.tajo.algebra.LiteralValue.LiteralType;
 
 import java.lang.reflect.Type;
 
-public abstract class Expr implements JsonSerializable {
+public abstract class Expr implements JsonSerializable, Cloneable {
   @Expose @SerializedName("type")
   private static final String SERIALIZED_NAME_OF_OP_TYPE = "OpType";
   @Expose @SerializedName(SERIALIZED_NAME_OF_OP_TYPE)
@@ -85,6 +85,13 @@ public abstract class Expr implements JsonSerializable {
 	}
 
   @Override
+  public Object clone() throws CloneNotSupportedException {
+    Expr newExpr = (Expr) super.clone();
+    newExpr.opType = opType;
+    return newExpr;
+  }
+
+  @Override
   public String toString() {
     return toJson();
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java
index b776cd2..333c845 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java
@@ -82,4 +82,17 @@ public class FunctionExpr extends Expr {
     return signature.equals(another.signature) &&
         TUtil.checkEquals(params, another.params);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    FunctionExpr func = (FunctionExpr) super.clone();
+    func.signature = signature;
+    if (params != null) {
+      func.params = new Expr[params.length];
+      for (int i = 0; i < params.length; i++) {
+        func.params[i] = (Expr) params[i].clone();
+      }
+    }
+    return func;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/GeneralSetFunctionExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/GeneralSetFunctionExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/GeneralSetFunctionExpr.java
index 3d812e7..c10bd76 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/GeneralSetFunctionExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/GeneralSetFunctionExpr.java
@@ -34,7 +34,6 @@ public class GeneralSetFunctionExpr extends FunctionExpr {
    */
   protected GeneralSetFunctionExpr(OpType type, String signature, boolean distinct, Expr [] params) {
     super(type, signature, params);
-    Preconditions.checkArgument(OpType.isAggregationFunction(type));
     this.distinct = distinct;
   }
 
@@ -66,4 +65,11 @@ public class GeneralSetFunctionExpr extends FunctionExpr {
   public boolean equalsTo(Expr expr) {
     return distinct == ((GeneralSetFunctionExpr)expr).distinct;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    GeneralSetFunctionExpr newSetFunc = (GeneralSetFunctionExpr) super.clone();
+    newSetFunc.distinct = distinct;
+    return newSetFunc;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Having.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Having.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Having.java
index dbe6f21..5723496 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Having.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Having.java
@@ -62,4 +62,11 @@ public class Having extends UnaryOperator implements JsonSerializable {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Having having = (Having) super.clone();
+    having.qual = (Expr) qual.clone();
+    return having;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/InPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/InPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/InPredicate.java
index 52eb92a..51d89b7 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/InPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/InPredicate.java
@@ -41,4 +41,11 @@ public class InPredicate extends BinaryOperator {
   public Expr getInValue() {
     return right;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    InPredicate inPredicate = (InPredicate) super.clone();
+    inPredicate.not = not;
+    return inPredicate;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Insert.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Insert.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Insert.java
index 3f15957..ce9b703 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Insert.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Insert.java
@@ -23,6 +23,7 @@ import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 import org.apache.tajo.util.TUtil;
 
+import java.util.HashMap;
 import java.util.Map;
 
 public class Insert extends Expr {
@@ -140,4 +141,17 @@ public class Insert extends Expr {
         TUtil.checkEquals(location, another.location) &&
         TUtil.checkEquals(params, another.params);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Insert insert = (Insert) super.clone();
+    insert.overwrite = overwrite;
+    insert.tableName = tableName;
+    insert.targetColumns = targetColumns != null ? targetColumns.clone() : null;
+    insert.storageType = storageType;
+    insert.location = location;
+    insert.subquery = (Expr) subquery.clone();
+    insert.params = new HashMap<String, String>(params);
+    return insert;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/IsNullPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/IsNullPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/IsNullPredicate.java
index f9f6e11..caa62c7 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/IsNullPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/IsNullPredicate.java
@@ -24,7 +24,7 @@ import com.google.gson.annotations.SerializedName;
 
 public class IsNullPredicate extends UnaryOperator {
   @Expose @SerializedName("IsNot")
-  private final boolean not;
+  private boolean not;
 
   public IsNullPredicate(boolean not, Expr column) {
     super(OpType.IsNullPredicate);
@@ -49,4 +49,11 @@ public class IsNullPredicate extends UnaryOperator {
     IsNullPredicate nullPredicate = (IsNullPredicate) expr;
     return not == nullPredicate.not;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    IsNullPredicate nullPredicate = (IsNullPredicate) super.clone();
+    nullPredicate.not = not;
+    return nullPredicate;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
index 2acdde3..2b1f344 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
@@ -91,4 +91,19 @@ public class Join extends BinaryOperator {
   public String toJson() {
     return JsonHelper.toJson(this);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Join join = (Join) super.clone();
+    join.joinType = joinType;
+    join.joinQual = (Expr) joinQual.clone();
+    if (joinColumns != null) {
+      join.joinColumns = new ColumnReferenceExpr[joinColumns.length];
+      for (ColumnReferenceExpr colume : joinColumns) {
+        join.joinColumns = (ColumnReferenceExpr[]) colume.clone();
+      }
+    }
+    join.natural = natural;
+    return join;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java
index 20dad6b..3a49ac7 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java
@@ -55,4 +55,11 @@ public class Limit extends UnaryOperator {
     Limit another = (Limit) expr;
     return fetchFirstNum.equals(another.fetchFirstNum);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Limit limit = (Limit) super.clone();
+    limit.fetchFirstNum = (Expr) fetchFirstNum.clone();
+    return limit;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralValue.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralValue.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralValue.java
index 7747ff9..d829f70 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralValue.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralValue.java
@@ -87,4 +87,12 @@ public class LiteralValue extends Expr {
       return LiteralType.String;
     }
   }
+
+  @Override
+  public LiteralValue clone() throws CloneNotSupportedException {
+    LiteralValue literal = (LiteralValue) super.clone();
+    literal.valueType = valueType;
+    literal.value = value;
+    return literal;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/NamedExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/NamedExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/NamedExpr.java
index 31e835f..7a0af05 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/NamedExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/NamedExpr.java
@@ -89,4 +89,11 @@ public class NamedExpr extends UnaryOperator {
   public String toJson() {
     return JsonHelper.toJson(this);
   }
+
+  @Override
+  public NamedExpr clone() throws CloneNotSupportedException {
+    NamedExpr namedExpr = (NamedExpr) super.clone();
+    namedExpr.alias = alias;
+    return namedExpr;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/OpType.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/OpType.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/OpType.java
index bc6e89b..19c4ab5 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/OpType.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/OpType.java
@@ -94,11 +94,10 @@ public enum OpType {
   Column(ColumnReferenceExpr.class),
   Target(NamedExpr.class),
   Function(FunctionExpr.class),
-  WindowFunction(WindowFunctionExpr.class),
-  WindowSpec(WindowSpecExpr.class),
   Asterisk(QualifiedAsteriskExpr.class),
 
   // Set Functions
+  WindowFunction(WindowFunctionExpr.class),
   CountRowsFunction(CountRowsFunctionExpr.class),
   GeneralSetFunction(GeneralSetFunctionExpr.class),
 
@@ -142,13 +141,36 @@ public enum OpType {
     }
   }
 
+  public static boolean isLogicalType(OpType type) {
+    return type == Not || type == And || type == Or;
+  }
+
+  public static boolean isComparisonType(OpType type) {
+    return
+        type == OpType.Equals ||
+        type == OpType.NotEquals ||
+        type == OpType.LessThan ||
+        type == OpType.GreaterThan ||
+        type == OpType.LessThanOrEquals ||
+        type == OpType.GreaterThanOrEquals;
+  }
+
+  public static boolean isArithmeticType(OpType type) {
+    return
+        type == Plus ||
+        type == Minus ||
+        type == Multiply ||
+        type == Divide ||
+        type == Modular;
+  }
+
   /**
    * Check if it is one of the literal types.
    *
    * @param type The type to be checked
    * @return True if it is one of the literal types. Otherwise, it returns False.
    */
-  public static boolean isLiteral(OpType type) {
+  public static boolean isLiteralType(OpType type) {
     return  type == Literal ||
             type == NullLiteral ||
             type == TimeLiteral ||
@@ -163,7 +185,7 @@ public enum OpType {
    * @return True if it is aggregation function type. Otherwise, it returns False.
    */
   public static boolean isFunction(OpType type) {
-    return type == Function || isAggregationFunction(type);
+    return type == Function || isAggregationFunction(type) || isWindowFunction(type);
   }
 
   /**
@@ -175,4 +197,14 @@ public enum OpType {
   public static boolean isAggregationFunction(OpType type) {
     return type == GeneralSetFunction || type == CountRowsFunction;
   }
+
+  /**
+   * Check if it is an window function type.
+   *
+   * @param type The type to be checked
+   * @return True if it is window function type. Otherwise, it returns False.
+   */
+  public static boolean isWindowFunction(OpType type) {
+    return type == WindowFunction;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/PatternMatchPredicate.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/PatternMatchPredicate.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/PatternMatchPredicate.java
index 2399e03..14c7d41 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/PatternMatchPredicate.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/PatternMatchPredicate.java
@@ -65,4 +65,12 @@ public class PatternMatchPredicate extends BinaryOperator {
     return opType == another.opType &&
         not == another.not && caseInsensitive == another.caseInsensitive;
   }
+
+  @Override
+  public PatternMatchPredicate clone() throws CloneNotSupportedException {
+    PatternMatchPredicate patternMatchPredicate = (PatternMatchPredicate) super.clone();
+    patternMatchPredicate.not = not;
+    patternMatchPredicate.caseInsensitive = caseInsensitive;
+    return patternMatchPredicate;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java
index 6ffc502..24c4399 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java
@@ -69,10 +69,16 @@ public class Projection extends UnaryOperator implements Cloneable {
     return JsonHelper.toJson(this);
   }
 
+  @Override
   public Projection clone() throws CloneNotSupportedException {
     Projection projection = (Projection)super.clone();
     projection.distinct = distinct;
-    projection.targets = targets;
+    if (targets != null) {
+      projection.targets = new NamedExpr[targets.length];
+      for (int i = 0; i < targets.length; i++) {
+        projection.targets[i] = targets[i].clone();
+      }
+    }
 
     return projection;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
index f067e59..e7ab208 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/QualifiedAsteriskExpr.java
@@ -64,4 +64,11 @@ public class QualifiedAsteriskExpr extends Expr {
   public String toString() {
     return hasQualifier() ? qualifier + "." + ASTERISK : ASTERISK;
   }
+
+  @Override
+  public QualifiedAsteriskExpr clone() throws CloneNotSupportedException {
+    QualifiedAsteriskExpr qualifiedAsteriskExpr = (QualifiedAsteriskExpr) super.clone();
+    qualifiedAsteriskExpr.qualifier = qualifier;
+    return qualifiedAsteriskExpr;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java
index c865454..2092b67 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java
@@ -74,4 +74,12 @@ public class Relation extends Expr {
     return TUtil.checkEquals(tableName, other.tableName) &&
         TUtil.checkEquals(alias, other.alias);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Relation relation = (Relation) super.clone();
+    relation.tableName = tableName;
+    relation.alias = alias;
+    return relation;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/RelationList.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/RelationList.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/RelationList.java
index fdf6c94..ad7315b 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/RelationList.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/RelationList.java
@@ -68,4 +68,14 @@ public class RelationList extends Expr {
     Set<Expr> anotherSet = TUtil.newHashSet(another.relations);
     return thisSet.equals(anotherSet);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    RelationList relationList = (RelationList) super.clone();
+    relationList.relations = new Expr[relations.length];
+    for (int i = 0; i < relations.length; i++) {
+      relationList.relations[i] = (Expr) relations[i].clone();
+    }
+    return relationList;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java
index 9cc245e..a2e6504 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java
@@ -61,4 +61,11 @@ public class Selection extends UnaryOperator implements JsonSerializable {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Selection selection = (Selection) super.clone();
+    selection.qual = (Expr) qual.clone();
+    return selection;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java
index c20bf06..71ee1c8 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java
@@ -52,4 +52,11 @@ public class SetOperation extends BinaryOperator {
     SetOperation another = (SetOperation) expr;
     return distinct == another.distinct;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    SetOperation setOperation = (SetOperation) super.clone();
+    setOperation.distinct = distinct;
+    return setOperation;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/SignedExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/SignedExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/SignedExpr.java
index 0c04341..c82b0f3 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/SignedExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/SignedExpr.java
@@ -44,4 +44,11 @@ public class SignedExpr extends UnaryOperator {
   boolean equalsTo(Expr expr) {
     return negative == ((SignedExpr)expr).negative;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    SignedExpr signedExpr = (SignedExpr) super.clone();
+    signedExpr.negative = negative;
+    return signedExpr;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java
index 0632b2e..7d5cb55 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java
@@ -56,7 +56,17 @@ public class Sort extends UnaryOperator {
     return JsonHelper.toJson(this);
   }
 
-  public static class SortSpec {
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    Sort sort = (Sort) super.clone();
+    sort.sortSpecs = new SortSpec[sortSpecs.length];
+    for (int i = 0; i < sortSpecs.length; i++) {
+      sort.sortSpecs[i] = (SortSpec) sortSpecs[i].clone();
+    }
+    return sort;
+  }
+
+  public static class SortSpec implements Cloneable {
     @Expose @SerializedName("SortKey")
     private Expr key;
     @Expose @SerializedName("IsAsc")
@@ -98,6 +108,10 @@ public class Sort extends UnaryOperator {
       this.nullFirst = true;
     }
 
+    public void setKey(Expr expr) {
+      this.key = expr;
+    }
+
     public final Expr getKey() {
       return this.key;
     }
@@ -122,5 +136,14 @@ public class Sort extends UnaryOperator {
     public String toString() {
       return key + " " + (asc ? "asc" : "desc") + " " + (nullFirst ? "null first" :"");
     }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      SortSpec sortSpec = (SortSpec) super.clone();
+      sortSpec.key = (Expr) key.clone();
+      sortSpec.asc = asc;
+      sortSpec.nullFirst = nullFirst;
+      return sortSpec;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/TablePrimarySubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TablePrimarySubQuery.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TablePrimarySubQuery.java
index 5c55164..6f08b0d 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TablePrimarySubQuery.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TablePrimarySubQuery.java
@@ -63,4 +63,14 @@ public class TablePrimarySubQuery extends Relation {
   public String toJson() {
     return JsonHelper.toJson(this);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    TablePrimarySubQuery subQuery = (TablePrimarySubQuery) super.clone();
+    subQuery.subquery = (Expr) subquery.clone();
+    if (columnNames != null) {
+      subQuery.columnNames = columnNames.clone();
+    }
+    return subQuery;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeLiteral.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeLiteral.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeLiteral.java
index 7baccd8..cba2293 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeLiteral.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeLiteral.java
@@ -51,4 +51,11 @@ public class TimeLiteral extends Expr {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    TimeLiteral timeLiteral = (TimeLiteral) super.clone();
+    timeLiteral.time = (TimeValue) timeLiteral.time.clone();
+    return timeLiteral;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeValue.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeValue.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeValue.java
index 6ad75bc..cc8cc88 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeValue.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimeValue.java
@@ -23,7 +23,7 @@ import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 import org.apache.commons.lang.StringUtils;
 
-public class TimeValue {
+public class TimeValue implements Cloneable {
   @Expose @SerializedName("Hour")
   private String hours;
   @Expose @SerializedName("Minute")
@@ -82,4 +82,14 @@ public class TimeValue {
   public int hashCode() {
     return Objects.hashCode(hours, minutes, seconds);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    TimeValue timeValue = (TimeValue) super.clone();
+    timeValue.hours = hours;
+    timeValue.minutes = minutes;
+    timeValue.seconds = seconds;
+    timeValue.secondsFraction = secondsFraction;
+    return timeValue;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimestampLiteral.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimestampLiteral.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimestampLiteral.java
index 5ee20d3..a9ed6da 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimestampLiteral.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TimestampLiteral.java
@@ -22,7 +22,7 @@ import com.google.common.base.Objects;
 import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
-public class TimestampLiteral extends Expr {
+public class TimestampLiteral extends Expr implements Cloneable {
   @Expose @SerializedName("Date")
   private DateValue date;
   @Expose @SerializedName("Time")
@@ -58,4 +58,12 @@ public class TimestampLiteral extends Expr {
     }
     return false;
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    TimestampLiteral timestampLiteral = (TimestampLiteral) super.clone();
+    timestampLiteral.date = date;
+    timestampLiteral.time = time;
+    return timestampLiteral;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java
index e266393..b85d58c 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java
@@ -45,4 +45,11 @@ public abstract class UnaryOperator extends Expr {
   public int hashCode() {
     return Objects.hashCode(getType(), child.hashCode());
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    UnaryOperator unaryOperator = (UnaryOperator) super.clone();
+    unaryOperator.child = (Expr) child.clone();
+    return unaryOperator;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/ValueListExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ValueListExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ValueListExpr.java
index c5eafb6..32a5e82 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ValueListExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ValueListExpr.java
@@ -46,4 +46,14 @@ public class ValueListExpr extends Expr {
     ValueListExpr valueListExpr = (ValueListExpr) expr;
     return TUtil.checkEquals(values, valueListExpr.values);
   }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    ValueListExpr valueListExpr = (ValueListExpr) super.clone();
+    valueListExpr.values = new Expr[values.length];
+    for (int i = 0; i < values.length; i++) {
+      valueListExpr.values = (Expr[]) values[i].clone();
+    }
+    return valueListExpr;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/Window.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Window.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Window.java
index e9cd21c..8ac90a4 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Window.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Window.java
@@ -46,9 +46,9 @@ public class Window extends UnaryOperator {
 
   public static class WindowDefinition {
     private String windowName;
-    private WindowSpecExpr windowSpec;
+    private WindowSpec windowSpec;
 
-    public WindowDefinition(String windowName, WindowSpecExpr spec) {
+    public WindowDefinition(String windowName, WindowSpec spec) {
       this.windowName = windowName;
       this.windowSpec = spec;
     }
@@ -57,7 +57,7 @@ public class Window extends UnaryOperator {
       return windowName;
     }
 
-    public WindowSpecExpr getWindowSpec() {
+    public WindowSpec getWindowSpec() {
       return windowSpec;
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowFunctionExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowFunctionExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowFunctionExpr.java
index 517ec0f..14ff930 100644
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowFunctionExpr.java
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowFunctionExpr.java
@@ -19,19 +19,20 @@
 package org.apache.tajo.algebra;
 
 import com.google.common.base.Objects;
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
 import org.apache.tajo.util.TUtil;
 
-public class WindowFunctionExpr extends Expr {
-  // set function
-  GeneralSetFunctionExpr function;
+public class WindowFunctionExpr extends GeneralSetFunctionExpr {
 
   // over clause - only one of both is used.
+  @Expose @SerializedName("WindowName")
   private String windowName;
-  private WindowSpecExpr windowSpec;
+  @Expose @SerializedName("WindowSpec")
+  private WindowSpec windowSpec;
 
   public WindowFunctionExpr(GeneralSetFunctionExpr function) {
-    super(OpType.WindowFunction);
-    this.function = function;
+    super(OpType.WindowFunction, function.getSignature(), function.isDistinct(), function.getParams());
   }
 
   public boolean hasWindowName() {
@@ -50,11 +51,11 @@ public class WindowFunctionExpr extends Expr {
     return windowSpec != null;
   }
 
-  public void setWindowSpec(WindowSpecExpr windowSpec) {
+  public void setWindowSpec(WindowSpec windowSpec) {
     this.windowSpec = windowSpec;
   }
 
-  public WindowSpecExpr getWindowSpec() {
+  public WindowSpec getWindowSpec() {
     return this.windowSpec;
   }
 
@@ -64,7 +65,7 @@ public class WindowFunctionExpr extends Expr {
   }
 
   @Override
-  boolean equalsTo(Expr expr) {
+  public boolean equalsTo(Expr expr) {
     return TUtil.checkEquals(windowName, windowSpec);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpec.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpec.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpec.java
new file mode 100644
index 0000000..da10b91
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpec.java
@@ -0,0 +1,242 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.algebra;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.Expose;
+import org.apache.tajo.util.TUtil;
+
+public class WindowSpec implements Cloneable {
+  @Expose private String windowName;
+  @Expose private Expr [] partitionKeys; // OVER (PARTITION BY ?,...,?)
+  @Expose private Sort.SortSpec [] sortSpecs; // OVER (... ORDER BY ?,...,?)
+  @Expose private WindowFrame windowFrame;
+
+  public boolean hasWindowName() {
+    return windowName != null;
+  }
+
+  public void setWindowName(String windowName) {
+    this.windowName = windowName;
+  }
+
+  public String getWindowName() {
+    return this.windowName;
+  }
+
+  public boolean hasPartitionBy() {
+    return this.partitionKeys != null;
+  }
+
+  public void setPartitionKeys(Expr[] partitionKeys) {
+    this.partitionKeys = partitionKeys;
+  }
+
+  public Expr [] getPartitionKeys() {
+    return this.partitionKeys;
+  }
+
+  public boolean hasOrderBy() {
+    return this.sortSpecs != null;
+  }
+
+  public void setSortSpecs(Sort.SortSpec [] sortSpecs) {
+    this.sortSpecs = sortSpecs;
+  }
+
+  public Sort.SortSpec [] getSortSpecs() {
+    return this.sortSpecs;
+  }
+
+  public boolean hasWindowFrame() {
+    return windowFrame != null;
+  }
+
+  public void setWindowFrame(WindowFrame frame) {
+    this.windowFrame = frame;
+  }
+
+  public WindowFrame getWindowFrame() {
+    return windowFrame;
+  }
+
+  public Object clone() throws CloneNotSupportedException {
+    WindowSpec windowSpec = (WindowSpec) super.clone();
+    windowSpec.windowName = windowName;
+    if (hasPartitionBy()) {
+      windowSpec.partitionKeys = new Expr[windowSpec.partitionKeys.length];
+      for (int i = 0; i < partitionKeys.length; i++) {
+        windowSpec.partitionKeys[i] = (Expr) partitionKeys[i].clone();
+      }
+    }
+    if (hasOrderBy()) {
+      windowSpec.sortSpecs = new Sort.SortSpec[sortSpecs.length];
+      for (int i = 0; i < sortSpecs.length; i++) {
+        windowSpec.sortSpecs[i] = (Sort.SortSpec) sortSpecs[i].clone();
+      }
+    }
+    if (hasWindowFrame()) {
+      windowSpec.windowFrame = (WindowFrame) windowFrame.clone();
+    }
+    return windowSpec;
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hashCode(windowName, partitionKeys, sortSpecs);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj == this) {
+      return true;
+    }
+
+    if (obj instanceof WindowSpec) {
+      WindowSpec another = (WindowSpec) obj;
+      return TUtil.checkEquals(windowName, another.windowName) &&
+          TUtil.checkEquals(partitionKeys, another.partitionKeys) &&
+          TUtil.checkEquals(sortSpecs, another.sortSpecs) &&
+          TUtil.checkEquals(windowFrame, another.windowFrame);
+    } else {
+      return false;
+    }
+
+  }
+
+  public static enum WindowFrameUnit {
+    ROW,
+    RANGE
+  }
+
+  public static enum WindowFrameStartBoundType {
+    UNBOUNDED_PRECEDING,
+    CURRENT_ROW,
+    PRECEDING
+  }
+
+  public static enum WindowFrameEndBoundType {
+    UNBOUNDED_FOLLOWING,
+    CURRENT_ROW,
+    FOLLOWING
+  }
+
+  public static class WindowFrame implements Cloneable {
+    @Expose private WindowFrameUnit unit;
+    @Expose private WindowStartBound startBound;
+    @Expose private WindowEndBound endBound;
+
+    public WindowFrame(WindowFrameUnit unit, WindowStartBound startBound) {
+      this.unit = unit;
+      this.startBound = startBound;
+    }
+
+    public WindowFrame(WindowFrameUnit unit, WindowStartBound startBound, WindowEndBound endBound) {
+      this(unit, startBound);
+      this.endBound = endBound;
+    }
+
+    public WindowStartBound getStartBound() {
+      return startBound;
+    }
+
+    public boolean hasEndBound() {
+      return endBound != null;
+    }
+
+    public WindowEndBound getEndBound() {
+      return endBound;
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      WindowFrame frame = (WindowFrame) super.clone();
+      frame.unit = unit;
+      frame.startBound = (WindowStartBound) startBound.clone();
+      frame.endBound = (WindowEndBound) endBound.clone();
+      return frame;
+    }
+  }
+
+  public static class WindowStartBound implements Cloneable {
+    @Expose private WindowFrameStartBoundType boundType;
+    @Expose private Expr number;
+
+    public WindowStartBound(WindowFrameStartBoundType type) {
+      this.boundType = type;
+    }
+
+    public WindowFrameStartBoundType getBoundType() {
+      return boundType;
+    }
+
+    public boolean hasNumber() {
+      return this.number != null;
+    }
+
+    public void setNumber(Expr number) {
+      this.number = number;
+    }
+
+    public Expr getNumber() {
+      return number;
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      WindowStartBound start = (WindowStartBound) super.clone();
+      start.boundType = boundType;
+      start.number = (Expr) number.clone();
+      return start;
+    }
+  }
+
+  public static class WindowEndBound implements Cloneable {
+    @Expose private WindowFrameEndBoundType boundType;
+    @Expose private Expr number;
+
+    public WindowEndBound(WindowFrameEndBoundType type) {
+      this.boundType = type;
+    }
+
+    public WindowFrameEndBoundType getBoundType() {
+      return boundType;
+    }
+
+    public boolean hasNumber() {
+      return this.number != null;
+    }
+
+    public void setNumber(Expr number) {
+      this.number = number;
+    }
+
+    public Expr getNumber() {
+      return number;
+    }
+
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+      WindowEndBound end = (WindowEndBound) super.clone();
+      end.boundType = boundType;
+      end.number = (Expr) number.clone();
+      return end;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpecExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpecExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpecExpr.java
deleted file mode 100644
index 37c2ff1..0000000
--- a/tajo-algebra/src/main/java/org/apache/tajo/algebra/WindowSpecExpr.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.algebra;
-
-import com.google.common.base.Objects;
-import org.apache.tajo.util.TUtil;
-
-public class WindowSpecExpr extends Expr {
-  private String windowName;
-  private Expr [] partitionKeys; // OVER (PARTITION BY ?,...,?)
-  private Sort.SortSpec [] sortSpecs; // OVER (... ORDER BY ?,...,?)
-  private WindowFrame windowFrame;
-
-  public WindowSpecExpr() {
-    super(OpType.WindowSpec);
-  }
-
-  public boolean hasWindowName() {
-    return windowName != null;
-  }
-
-  public void setWindowName(String windowName) {
-    this.windowName = windowName;
-  }
-
-  public String getWindowName() {
-    return this.windowName;
-  }
-
-  public boolean hasPartitionBy() {
-    return this.partitionKeys != null;
-  }
-
-  public void setPartitionKeys(Expr[] partitionKeys) {
-    this.partitionKeys = partitionKeys;
-  }
-
-  public Expr [] getPartitionKeys() {
-    return this.partitionKeys;
-  }
-
-  public boolean hasOrderBy() {
-    return this.sortSpecs != null;
-  }
-
-  public void setSortSpecs(Sort.SortSpec [] sortSpecs) {
-    this.sortSpecs = sortSpecs;
-  }
-
-  public Sort.SortSpec [] getSortSpecs() {
-    return this.sortSpecs;
-  }
-
-  public boolean hasWindowFrame() {
-    return windowFrame != null;
-  }
-
-  public void setWindowFrame(WindowFrame frame) {
-    this.windowFrame = frame;
-  }
-
-  public WindowFrame getWindowFrame() {
-    return windowFrame;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(windowName, partitionKeys, sortSpecs);
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    WindowSpecExpr another = (WindowSpecExpr) expr;
-    return TUtil.checkEquals(windowName, another.windowName) &&
-        TUtil.checkEquals(partitionKeys, another.partitionKeys) &&
-        TUtil.checkEquals(sortSpecs, another.sortSpecs);
-  }
-
-  public static enum WindowFrameUnit {
-    ROW,
-    RANGE
-  }
-
-  public static enum WindowFrameStartBoundType {
-    UNBOUNDED_PRECEDING,
-    CURRENT_ROW,
-    PRECEDING
-  }
-
-  public static enum WindowFrameEndBoundType {
-    UNBOUNDED_FOLLOWING,
-    CURRENT_ROW,
-    FOLLOWING
-  }
-
-  public static class WindowFrame {
-    WindowFrameUnit unit;
-    private WindowStartBound startBound;
-    private WindowEndBound endBound;
-
-    public WindowFrame(WindowFrameUnit unit, WindowStartBound startBound) {
-      this.unit = unit;
-      this.startBound = startBound;
-    }
-
-    public WindowFrame(WindowFrameUnit unit, WindowStartBound startBound, WindowEndBound endBound) {
-      this(unit, startBound);
-      this.endBound = endBound;
-    }
-
-    public WindowStartBound getStartBound() {
-      return startBound;
-    }
-
-    public boolean hasEndBound() {
-      return endBound != null;
-    }
-
-    public WindowEndBound getEndBound() {
-      return endBound;
-    }
-  }
-
-  public static class WindowStartBound {
-    private WindowFrameStartBoundType boundType;
-    private Expr number;
-
-    public WindowStartBound(WindowFrameStartBoundType type) {
-      this.boundType = type;
-    }
-
-    public WindowFrameStartBoundType getBoundType() {
-      return boundType;
-    }
-
-    public void setNumber(Expr number) {
-      this.number = number;
-    }
-
-    public Expr getNumber() {
-      return number;
-    }
-  }
-
-  public static class WindowEndBound {
-    private WindowFrameEndBoundType boundType;
-    private Expr number;
-
-    public WindowEndBound(WindowFrameEndBoundType type) {
-      this.boundType = type;
-    }
-
-    public WindowFrameEndBoundType getBoundType() {
-      return boundType;
-    }
-
-    public Expr setNumber(Expr number) {
-      return number;
-    }
-
-    public Expr getNumber() {
-      return number;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
index 78df08f..d109470 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchFunctionException.java
@@ -26,6 +26,10 @@ import java.util.Collection;
 public class NoSuchFunctionException extends RuntimeException {
 	private static final long serialVersionUID = 5062193018697228028L;
 
+  public NoSuchFunctionException(String message) {
+    super(message);
+  }
+
   public NoSuchFunctionException(String funcName, TajoDataTypes.DataType [] parameters) {
     super("function " + CatalogUtil.getCanonicalSignature(funcName, parameters) + " does not exist");
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto b/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
index e70ed2b..367d0b8 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
+++ b/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
@@ -119,9 +119,11 @@ enum FunctionType {
   GENERAL = 0;
   AGGREGATION = 1;
   DISTINCT_AGGREGATION = 2;
-  UDF = 3;
-  UDA = 4;
-  DISTINCT_UDA = 5;
+  WINDOW = 3;
+  UDF = 4;
+  UDA = 5;
+  DISTINCT_UDA = 6;
+  WINDOW_UDA = 7;
 }
 
 message FunctionDescProto {

http://git-wip-us.apache.org/repos/asf/tajo/blob/d3ee50a9/tajo-core/src/main/java/org/apache/tajo/engine/eval/AggregationFunctionCallEval.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/eval/AggregationFunctionCallEval.java b/tajo-core/src/main/java/org/apache/tajo/engine/eval/AggregationFunctionCallEval.java
index 10eadce..ab18aa9 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/eval/AggregationFunctionCallEval.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/eval/AggregationFunctionCallEval.java
@@ -33,6 +33,11 @@ public class AggregationFunctionCallEval extends FunctionEval implements Cloneab
   @Expose boolean firstPhase = false;
   private Tuple params;
 
+  protected AggregationFunctionCallEval(EvalType type, FunctionDesc desc, AggFunction instance, EvalNode[] givenArgs) {
+    super(type, desc, givenArgs);
+    this.instance = instance;
+  }
+
   public AggregationFunctionCallEval(FunctionDesc desc, AggFunction instance, EvalNode[] givenArgs) {
     super(EvalType.AGG_FUNCTION, desc, givenArgs);
     this.instance = instance;


Mime
View raw message