tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [50/51] [partial] TAJO-22: The package prefix should be org.apache.tajo. (DaeMyung Kang via hyunsik)
Date Tue, 02 Jul 2013 14:16:44 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExprType.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExprType.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExprType.java
new file mode 100644
index 0000000..f94e567
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ExprType.java
@@ -0,0 +1,99 @@
+/**
+ * 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.gson.*;
+
+import java.lang.reflect.Type;
+
+public enum ExprType {
+  // relational operators
+  Relation(Relation.class),
+  TableSubQuery(TableSubQuery.class),
+  Except(SetOperation.class),
+	Aggregation(org.apache.tajo.algebra.Aggregation.class),
+  Intersect(SetOperation.class),
+  Join(Join.class),
+  Projection(Projection.class),
+  Rename,
+  Selection(Selection.class),
+  Sort(Sort.class),
+  Union(SetOperation.class),
+  Limit(Limit.class),
+
+  // extended relational operators
+  CreateTable(CreateTable.class),
+
+  // logical operators
+  And(BinaryOperator.class),
+  Or(BinaryOperator.class),
+
+  // comparison operators
+  Equals(BinaryOperator.class),
+  NotEquals(BinaryOperator.class),
+  LessThan(BinaryOperator.class),
+  LessThanOrEquals(BinaryOperator.class),
+  GreaterThan(BinaryOperator.class),
+  GreaterThanOrEquals(BinaryOperator.class),
+
+  // arithmetic operators
+  Plus(BinaryOperator.class),
+  Minus(BinaryOperator.class),
+  Multiply(BinaryOperator.class),
+  Divide(BinaryOperator.class),
+  Mod(BinaryOperator.class),
+
+  // other expressions
+  Column(ColumnReferenceExpr.class),
+  Function(FunctionExpr.class),
+  CaseWhen(CaseWhenExpr.class),
+  Like(LikeExpr.class),
+  Literal(LiteralExpr.class),
+  ScalarSubQuery(ScalarSubQuery.class);
+
+  private Class baseClass;
+
+  ExprType() {
+    this.baseClass = Expr.class;
+  }
+  ExprType(Class clazz) {
+    this.baseClass = clazz;
+  }
+
+  public Class getBaseClass() {
+    return this.baseClass;
+  }
+
+  public static class JsonSerDer implements JsonSerializer<ExprType>,
+                                            JsonDeserializer<ExprType> {
+
+    @Override
+    public JsonElement serialize(ExprType src, Type typeOfSrc,
+                                 JsonSerializationContext context) {
+      return new JsonPrimitive(src.name());
+    }
+
+    @Override
+    public ExprType deserialize(JsonElement json, Type typeOfT,
+                                      JsonDeserializationContext context)
+        throws JsonParseException {
+      return ExprType.valueOf(json.getAsString());
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..3bab189
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/FunctionExpr.java
@@ -0,0 +1,45 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class FunctionExpr extends Expr {
+  private String signature;
+  private Expr[] params;
+
+  public FunctionExpr(String signature) {
+    super(ExprType.Function);
+  }
+
+  public void setParams(Expr[] params) {
+    this.params = params;
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    FunctionExpr another = (FunctionExpr) expr;
+    return signature.equals(another.signature) &&
+        TUtil.checkEquals(params, another.params);
+  }
+
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..c2316fd
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
@@ -0,0 +1,82 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Join extends BinaryOperator {
+  private JoinType join_type;
+  private Expr join_qual;
+  private ColumnReferenceExpr [] join_columns;
+  private boolean natural = false;
+
+  public Join(JoinType joinType) {
+    super(ExprType.Join);
+    this.join_type = joinType;
+  }
+
+  public JoinType getJoinType() {
+    return  this.join_type;
+  }
+
+  public boolean hasQual() {
+    return this.join_qual != null;
+  }
+
+  public Expr getQual() {
+    return this.join_qual;
+  }
+
+  public void setQual(Expr expr) {
+    this.join_qual = expr;
+  }
+
+  public boolean hasJoinColumns() {
+    return join_columns != null;
+  }
+
+  public ColumnReferenceExpr [] getJoinColumns() {
+    return join_columns;
+  }
+
+  public void setJoinColumns(ColumnReferenceExpr[] columns) {
+    join_columns = columns;
+  }
+
+  public void setNatural() {
+    natural = true;
+  }
+
+  public boolean isNatural() {
+    return natural;
+  }
+
+  boolean equalsTo(Expr expr) {
+    Join another = (Join) expr;
+    return join_type.equals(another.join_type) &&
+        TUtil.checkEquals(join_qual, another.join_qual) &&
+        TUtil.checkEquals(join_columns, another.join_columns) &&
+        natural == another.natural;
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/JoinType.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/JoinType.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JoinType.java
new file mode 100644
index 0000000..3e0a137
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JoinType.java
@@ -0,0 +1,28 @@
+/**
+ * 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;
+
+public enum JoinType {
+  CROSS_JOIN,
+  INNER,
+  LEFT_OUTER,
+  RIGHT_OUTER,
+  FULL_OUTER,
+  UNION
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonHelper.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonHelper.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonHelper.java
new file mode 100644
index 0000000..5cf0376
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonHelper.java
@@ -0,0 +1,57 @@
+/**
+ * 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.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public class JsonHelper {
+  private static JsonHelper instance;
+
+  private GsonBuilder builder;
+  private Gson gson;
+
+  static {
+    instance = new JsonHelper();
+  }
+
+  private JsonHelper() {
+    initBuilder();
+    gson = builder.create();
+  }
+
+  private void initBuilder() {
+    builder = new GsonBuilder().setPrettyPrinting();
+    builder.registerTypeAdapter(ExprType.class, new ExprType.JsonSerDer());
+    builder.registerTypeAdapter(Expr.class, new Expr.JsonSerDer());
+  }
+
+
+  public static Gson getInstance() {
+    return instance.gson;
+  }
+
+  public static String toJson(Object obj) {
+    return instance.gson.toJson(obj);
+  }
+
+  public static <T> T fromJson(String json, Class<T> clazz) {
+    return instance.gson.fromJson(json, clazz);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonSerializable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonSerializable.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonSerializable.java
new file mode 100644
index 0000000..0f4dedd
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/JsonSerializable.java
@@ -0,0 +1,23 @@
+/**
+ * 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;
+
+public interface JsonSerializable {
+  String toJson();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/LikeExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/LikeExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LikeExpr.java
new file mode 100644
index 0000000..ac73d74
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LikeExpr.java
@@ -0,0 +1,51 @@
+/**
+ * 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;
+
+public class LikeExpr extends BinaryOperator {
+  private boolean not;
+  private ColumnReferenceExpr column_ref;
+  private Expr pattern;
+
+  public LikeExpr(boolean not, ColumnReferenceExpr columnReferenceExpr, Expr pattern) {
+    super(ExprType.Like);
+    this.not = not;
+    this.column_ref = columnReferenceExpr;
+    this.pattern = pattern;
+  }
+
+  public boolean isNot() {
+    return not;
+  }
+
+  public ColumnReferenceExpr getColumnRef() {
+    return this.column_ref;
+  }
+
+  public Expr getPattern() {
+    return this.pattern;
+  }
+
+  boolean equalsTo(Expr expr) {
+    LikeExpr another = (LikeExpr) expr;
+    return not == another.not &&
+        column_ref.equals(another.column_ref) &&
+        pattern.equals(another.pattern);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..e3ded02
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Limit.java
@@ -0,0 +1,49 @@
+/**
+ * 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;
+
+
+public class Limit extends UnaryOperator {
+  private Expr fetch_first_num;
+
+  public Limit(Expr fetch_first_num) {
+    super(ExprType.Limit);
+    this.fetch_first_num = fetch_first_num;
+  }
+
+  public Expr getFetchFirstNum() {
+    return this.fetch_first_num;
+  }
+
+  @Override
+  public String toString() {
+    return toJson();
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    Limit another = (Limit) expr;
+    return fetch_first_num.equals(another.fetch_first_num);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralExpr.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralExpr.java
new file mode 100644
index 0000000..df8f4dd
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/LiteralExpr.java
@@ -0,0 +1,53 @@
+/**
+ * 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;
+
+public class LiteralExpr extends Expr {
+  private String value;
+  private LiteralType value_type;
+
+  public static enum LiteralType {
+    String,
+    Unsigned_Integer,
+    Unsigned_Float,
+    Unsigned_Large_Integer,
+  }
+
+  public LiteralExpr(String value, LiteralType value_type) {
+    super(ExprType.Literal);
+    this.value = value;
+    this.value_type = value_type;
+  }
+
+  public String getValue() {
+    return this.value;
+  }
+
+  public LiteralType getValueType() {
+    return this.value_type;
+  }
+
+  public boolean equalsTo(Expr expr) {
+    LiteralExpr another = (LiteralExpr) expr;
+    boolean a = value_type.equals(another.value_type);
+    boolean b =  value.equals(another.value);
+
+    return a && b;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..bc66bc0
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Projection.java
@@ -0,0 +1,68 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Projection extends UnaryOperator implements Cloneable {
+  private boolean project_all;
+  private boolean distinct = false;
+
+  private Target [] targets;
+
+  public Projection() {
+    super(ExprType.Projection);
+  }
+
+  public boolean isDistinct() {
+    return distinct;
+  }
+
+  public void setDistinct() {
+    distinct = true;
+  }
+
+  public void setAll() {
+    project_all = true;
+  }
+
+  public boolean isAllProjected() {
+    return project_all;
+  }
+	
+	public Target [] getTargets() {
+	  return this.targets;
+	}
+
+  public void setTargets(Target [] targets) {
+    this.targets = targets;
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    Projection another = (Projection) expr;
+    return TUtil.checkEquals(project_all, another.project_all) &&
+        TUtil.checkEquals(targets, another.targets);
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..df44b12
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Relation.java
@@ -0,0 +1,70 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Relation extends Expr {
+  private String rel_name;
+  private String alias;
+
+  protected Relation(ExprType type, String relationName) {
+    super(type);
+    this.rel_name = relationName;
+  }
+
+  public Relation(String relationName) {
+    this(ExprType.Relation, relationName);
+  }
+
+  public String getName() {
+    return rel_name;
+  }
+
+  public boolean hasAlias() {
+    return alias != null;
+  }
+
+  public String getAlias() {
+    return this.alias;
+  }
+
+  public void setAlias(String alias) {
+    this.alias = alias;
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    Relation other = (Relation) expr;
+    return TUtil.checkEquals(rel_name, other.rel_name) &&
+        TUtil.checkEquals(alias, other.alias);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = rel_name.hashCode();
+    result = 31 * result + (alias != null ? alias.hashCode() : 0);
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/ScalarSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/ScalarSubQuery.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ScalarSubQuery.java
new file mode 100644
index 0000000..f07cb31
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/ScalarSubQuery.java
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+public class ScalarSubQuery extends Expr {
+  private Expr subquery;
+  public ScalarSubQuery(Expr subQuery) {
+    super(ExprType.ScalarSubQuery);
+    this.subquery = subQuery;
+  }
+
+  public Expr getSubQuery() {
+    return this.subquery;
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    ScalarSubQuery another = (ScalarSubQuery) expr;
+    return subquery.equals(another);
+  }
+
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..d9f68bc
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Selection.java
@@ -0,0 +1,57 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Selection extends UnaryOperator implements JsonSerializable {
+  private Expr search_condition;
+
+  public Selection(Expr relation, Expr qual) {
+    super(ExprType.Selection);
+    setChild(relation);
+    search_condition = qual;
+  }
+
+  public boolean hasQual() {
+    return search_condition != null;
+  }
+
+  public void setQual(Expr expr) {
+    this.search_condition = expr;
+  }
+
+	public Expr getQual() {
+		return this.search_condition;
+	}
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+
+  @Override
+  public boolean equalsTo(Expr expr) {
+    if (expr instanceof Selection) {
+      Selection other = (Selection) expr;
+      return TUtil.checkEquals(search_condition, other.search_condition);
+    }
+    return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..8a5ff9e
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/SetOperation.java
@@ -0,0 +1,46 @@
+/**
+ * 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.Preconditions;
+
+public class SetOperation extends BinaryOperator {
+  private boolean distinct = true;
+
+  public SetOperation(ExprType type, Expr left, Expr right, boolean distinct) {
+    super(type, left, right);
+    Preconditions.checkArgument(type == ExprType.Union ||
+        type == ExprType.Intersect ||
+        type == ExprType.Except);
+  }
+
+  public boolean isDistinct() {
+    return distinct;
+  }
+
+  public void unsetDistinct() {
+    distinct = false;
+  }
+
+  boolean equalsTo(Expr expr) {
+    SetOperation another = (SetOperation) expr;
+    return distinct == another.distinct;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..7260e97
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Sort.java
@@ -0,0 +1,103 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Sort extends UnaryOperator {
+  private SortSpec [] sort_specs;
+
+  public Sort(final SortSpec [] sortSpecs) {
+    super(ExprType.Sort);
+    this.sort_specs = sortSpecs;
+  }
+
+  public void setSortSpecs(SortSpec[] sort_specs) {
+    this.sort_specs = sort_specs;
+  }
+
+  public SortSpec [] getSortSpecs() {
+    return this.sort_specs;
+  }
+
+  @Override
+  public boolean equalsTo(Expr expr) {
+    Sort another = (Sort) expr;
+    return TUtil.checkEquals(sort_specs, another.sort_specs);
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+
+  public static class SortSpec {
+    private ColumnReferenceExpr key;
+    private boolean asc = true;
+    private boolean null_first = false;
+
+    public SortSpec(final ColumnReferenceExpr key) {
+      this.key = key;
+    }
+
+    /**
+     *
+     * @param sortKey a column to sort
+     * @param asc true if the sort order is ascending order
+     * @param nullFirst
+     * Otherwise, it should be false.
+     */
+    public SortSpec(final ColumnReferenceExpr sortKey, final boolean asc,
+                    final boolean nullFirst) {
+      this(sortKey);
+      this.asc = asc;
+      this.null_first = nullFirst;
+    }
+
+    public final boolean isAscending() {
+      return this.asc;
+    }
+
+    public final void setDescending() {
+      this.asc = false;
+    }
+
+    public final boolean isNullFirst() {
+      return this.null_first;
+    }
+
+    public final void setNullFirst() {
+      this.null_first = true;
+    }
+
+    public final ColumnReferenceExpr getKey() {
+      return this.key;
+    }
+
+    public boolean equals(Object obj) {
+      if (obj instanceof SortSpec) {
+        SortSpec other = (SortSpec) obj;
+        return TUtil.checkEquals(key, other.key) &&
+            TUtil.checkEquals(asc, other.asc) &&
+            TUtil.checkEquals(null_first, other.null_first);
+      }
+      return false;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/TableSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/TableSubQuery.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TableSubQuery.java
new file mode 100644
index 0000000..d46dc4a
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/TableSubQuery.java
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+public class TableSubQuery extends Relation {
+  private Expr subquery;
+
+  public TableSubQuery(String relName, Expr subquery) {
+    super(ExprType.TableSubQuery, relName);
+    this.subquery = subquery;
+  }
+
+  public Expr getSubQuery() {
+    return subquery;
+  }
+
+  @Override
+  boolean equalsTo(Expr expr) {
+    return subquery.equals(subquery);
+  }
+
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/org/apache/tajo/algebra/Target.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/org/apache/tajo/algebra/Target.java b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Target.java
new file mode 100644
index 0000000..f7019ea
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/Target.java
@@ -0,0 +1,61 @@
+/**
+ * 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 org.apache.tajo.util.TUtil;
+
+public class Target implements JsonSerializable {
+  private Expr expr;
+  private String alias;
+
+  public Target(Expr expr) {
+   this.expr = expr;
+  }
+
+  public Expr getExpr() {
+    return expr;
+  }
+
+  public boolean hasAlias() {
+    return this.alias != null;
+  }
+
+  public String getAlias() {
+    return this.alias;
+  }
+
+  public void setAlias(String alias) {
+    this.alias = alias;
+  }
+
+  @Override
+  public String toJson() {
+    return JsonHelper.toJson(this);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof Target) {
+      Target another = (Target) obj;
+      return expr.equals(another.expr) && TUtil.checkEquals(alias, another.alias);
+    }
+
+    return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/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
new file mode 100644
index 0000000..59db158
--- /dev/null
+++ b/tajo-algebra/src/main/java/org/apache/tajo/algebra/UnaryOperator.java
@@ -0,0 +1,35 @@
+/**
+ * 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;
+
+public abstract class UnaryOperator extends Expr {
+  private Expr child;
+
+  public UnaryOperator(ExprType type) {
+    super(type);
+  }
+
+  public Expr getChild() {
+    return this.child;
+  }
+
+  public void setChild(Expr op) {
+    this.child = op;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Aggregation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Aggregation.java b/tajo-algebra/src/main/java/tajo/algebra/Aggregation.java
deleted file mode 100644
index 6571414..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Aggregation.java
+++ /dev/null
@@ -1,116 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Aggregation extends UnaryOperator {
-  private Target [] targets;
-  private GroupElement [] groups;
-  private Expr havingCondition;
-
-  public Aggregation() {
-    super(ExprType.Aggregation);
-  }
-
-  public Target [] getTargets() {
-    return this.targets;
-  }
-
-  public void setTargets(Target [] targets) {
-    this.targets = targets;
-  }
-
-  public boolean hasHavingCondition() {
-    return havingCondition != null;
-  }
-
-  public Expr getHavingCondition() {
-    return havingCondition;
-  }
-
-  public void setHavingCondition(Expr expr) {
-    this.havingCondition = expr;
-  }
-
-  public void setGroups(GroupElement [] groups) {
-    this.groups = groups;
-  }
-
-  public boolean isEmptyGrouping() {
-    return groups == null || groups.length == 0;
-  }
-
-  public GroupElement [] getGroupSet() {
-    return groups;
-  }
-
-  @Override
-  public boolean equalsTo(Expr expr) {
-    Aggregation another = (Aggregation) expr;
-    boolean a = TUtil.checkEquals(groups, another.groups);
-    boolean b = TUtil.checkEquals(targets, another.targets);
-    boolean c = TUtil.checkEquals(havingCondition, another.havingCondition);
-
-    return a && b && c;
-  }
-
-  public static class GroupElement implements JsonSerializable {
-    private GroupType group_type;
-    private ColumnReferenceExpr[] columns;
-
-    public GroupElement(GroupType groupType, ColumnReferenceExpr[] columns) {
-      this.group_type = groupType;
-      this.columns = columns;
-    }
-
-    public GroupType getType() {
-      return this.group_type;
-    }
-
-    public ColumnReferenceExpr[] getColumns() {
-      return this.columns;
-    }
-
-    public String toString() {
-      return toJson();
-    }
-
-    @Override
-    public String toJson() {
-      return JsonHelper.toJson(this);
-    }
-
-    public boolean equals(Object obj) {
-      if (obj instanceof GroupElement) {
-        GroupElement other = (GroupElement) obj;
-        return group_type.equals(other) &&
-            TUtil.checkEquals(columns, other.columns);
-      }
-
-      return false;
-    }
-  }
-
-  public static enum GroupType {
-    GROUPBY,
-    CUBE,
-    ROLLUP
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/BinaryOperator.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/BinaryOperator.java b/tajo-algebra/src/main/java/tajo/algebra/BinaryOperator.java
deleted file mode 100644
index eb06402..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/BinaryOperator.java
+++ /dev/null
@@ -1,55 +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 tajo.algebra;
-
-public class BinaryOperator extends Expr {
-  Expr left;
-  Expr right;
-
-  BinaryOperator(ExprType opType) {
-    super(opType);
-  }
-
-  public BinaryOperator(ExprType type, Expr left, Expr right) {
-    super(type);
-    this.left = left;
-    this.right = right;
-  }
-
-  public Expr getLeft() {
-    return this.left;
-  }
-
-  public void setLeft(Expr left) {
-    this.left = left;
-  }
-
-  public Expr getRight() {
-    return this.right;
-  }
-
-  public void setRight(Expr right) {
-    this.right = right;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    return true;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/CaseWhenExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/CaseWhenExpr.java b/tajo-algebra/src/main/java/tajo/algebra/CaseWhenExpr.java
deleted file mode 100644
index 8dd2bed..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/CaseWhenExpr.java
+++ /dev/null
@@ -1,88 +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 tajo.algebra;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class CaseWhenExpr extends Expr {
-  private List<WhenExpr> whens = new ArrayList<WhenExpr>();
-  private Expr else_result;
-
-  public CaseWhenExpr() {
-    super(ExprType.CaseWhen);
-  }
-
-  public void addWhen(Expr condition, Expr result) {
-    whens.add(new WhenExpr(condition, result));
-  }
-
-  public Collection<WhenExpr> getWhens() {
-    return this.whens;
-  }
-
-  public void setElseResult(Expr else_result) {
-    this.else_result = else_result;
-  }
-
-  public Object getElseResult() {
-    return this.else_result;
-  }
-
-  public boolean hasElseResult() {
-    return else_result != null;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    return false;
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  public static class WhenExpr {
-    Expr condition;
-    Expr result;
-
-    public WhenExpr(Expr condition, Expr result) {
-      this.condition = condition;
-      this.result = result;
-    }
-
-    public Expr getCondition() {
-      return this.condition;
-    }
-
-    public Expr getResult() {
-      return this.result;
-    }
-
-    public boolean equals(Object obj) {
-      if (obj instanceof WhenExpr) {
-        WhenExpr another = (WhenExpr) obj;
-      }
-
-      return false;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/ColumnReferenceExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/ColumnReferenceExpr.java b/tajo-algebra/src/main/java/tajo/algebra/ColumnReferenceExpr.java
deleted file mode 100644
index dba02fd..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/ColumnReferenceExpr.java
+++ /dev/null
@@ -1,49 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class ColumnReferenceExpr extends Expr {
-  private String rel_name;
-  private String column_name;
-
-  public ColumnReferenceExpr(String columnName) {
-    super(ExprType.Column);
-    this.column_name = columnName;
-  }
-
-  public void setRelationName(String tableName) {
-    this.rel_name = tableName;
-  }
-
-  public String getName() {
-    return this.column_name;
-  }
-
-  public String getRelationName() {
-    return this.rel_name;
-  }
-
-  public boolean equalsTo(Expr expr) {
-    ColumnReferenceExpr another = (ColumnReferenceExpr) expr;
-    return column_name.equals(another.column_name) &&
-        TUtil.checkEquals(rel_name, another.rel_name);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/CreateTable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/CreateTable.java b/tajo-algebra/src/main/java/tajo/algebra/CreateTable.java
deleted file mode 100644
index f6e4169..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/CreateTable.java
+++ /dev/null
@@ -1,140 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-import java.util.Map;
-
-public class CreateTable extends Expr {
-  private String rel_name;
-  private ColumnDefinition [] table_elements;
-  private String storage_type;
-  private String location;
-  private Expr subquery;
-  private Map<String, String> params;
-
-  public CreateTable(final String tableName) {
-    super(ExprType.CreateTable);
-    this.rel_name = tableName;
-  }
-
-  public CreateTable(final String relationName, final Expr subQuery) {
-    this(relationName);
-    this.subquery = subQuery;
-  }
-
-  public String getRelationName() {
-    return this.rel_name;
-  }
-
-  public boolean hasLocation() {
-    return location != null;
-  }
-
-  public String getLocation() {
-    return this.location;
-  }
-
-  public void setLocation(String location) {
-    this.location = location;
-  }
-
-  public boolean hasTableElements() {
-    return this.table_elements != null;
-  }
-
-  public ColumnDefinition [] getTableElements() {
-    return table_elements;
-  }
-
-  public void setTableElements(ColumnDefinition [] tableElements) {
-    this.table_elements = tableElements;
-  }
-
-  public boolean hasStorageType() {
-    return storage_type != null;
-  }
-
-  public void setStorageType(String storageType) {
-    this.storage_type = storageType;
-  }
-
-  public String getStorageType() {
-    return storage_type;
-  }
-
-  public boolean hasParams() {
-    return params != null;
-  }
-
-  public Map<String, String> getParams() {
-    return params;
-  }
-
-  public void setParams(Map<String, String> params) {
-    this.params = params;
-  }
-
-  public boolean hasSubQuery() {
-    return subquery != null;
-  }
-
-  public Expr getSubQuery() {
-    return subquery;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    CreateTable another = (CreateTable) expr;
-    return rel_name.equals(another.rel_name) &&
-        TUtil.checkEquals(table_elements, another.table_elements) &&
-        TUtil.checkEquals(storage_type, another.storage_type) &&
-        TUtil.checkEquals(location, another.location) &&
-        TUtil.checkEquals(subquery, another.subquery) &&
-        TUtil.checkEquals(params, another.params);
-  }
-
-  public static class ColumnDefinition {
-    String col_name;
-    String data_type;
-
-    public ColumnDefinition(String columnName, String dataType) {
-      this.col_name = columnName;
-      this.data_type = dataType;
-    }
-
-    public String getColumnName() {
-      return this.col_name;
-    }
-
-    public String getDataType() {
-      return this.data_type;
-    }
-
-    public boolean equals(Object obj) {
-      if (obj instanceof ColumnDefinition) {
-        ColumnDefinition another = (ColumnDefinition) obj;
-        return col_name.equals(another.col_name) && data_type.equals(another.data_type);
-      }
-
-      return false;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Expr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Expr.java b/tajo-algebra/src/main/java/tajo/algebra/Expr.java
deleted file mode 100644
index db6e5fd..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Expr.java
+++ /dev/null
@@ -1,98 +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 tajo.algebra;
-
-import com.google.gson.*;
-
-import java.lang.reflect.Type;
-
-public abstract class Expr implements JsonSerializable {
-  protected ExprType op_type;
-
-	public Expr(ExprType op_type) {
-		this.op_type = op_type;
-	}
-	
-	public ExprType getType() {
-		return this.op_type;
-	}
-
-  abstract boolean equalsTo(Expr expr);
-
-	@Override
-	public boolean equals(Object obj) {
-	  if (obj instanceof Expr) {
-	    Expr casted = (Expr) obj;
-
-      if (this.op_type == casted.op_type && equalsTo(casted)) {
-        if (this instanceof UnaryOperator) {
-          UnaryOperator one = (UnaryOperator) this;
-          UnaryOperator another = (UnaryOperator) casted;
-          return one.getChild().equals(another.getChild());
-        } else if (this instanceof BinaryOperator) {
-
-          BinaryOperator bin = (BinaryOperator) this;
-          BinaryOperator anotherBin = (BinaryOperator) casted;
-
-          if (!bin.getLeft().equals(anotherBin.getLeft())) {
-            return false;
-          }
-          if (!bin.getRight().equals(anotherBin.getRight())) {
-            return false;
-          }
-
-          return true;
-        } else {
-          return this.equalsTo(casted);
-        }
-      }
-	  }
-
-    return false;
-	}
-
-  @Override
-  public String toString() {
-    return toJson();
-  }
-
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  static class JsonSerDer
-      implements JsonSerializer<Expr>, JsonDeserializer<Expr> {
-
-    @Override
-    public Expr deserialize(JsonElement json, Type typeOfT,
-                                    JsonDeserializationContext context)
-        throws JsonParseException {
-      JsonObject jsonObject = json.getAsJsonObject();
-      String operator = jsonObject.get("type").getAsString();
-      return context.deserialize(json, ExprType.valueOf(operator).getBaseClass());
-    }
-
-
-    @Override
-    public JsonElement serialize(Expr src, Type typeOfSrc,
-                                 JsonSerializationContext context) {
-      return context.serialize(src, src.op_type.getBaseClass());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/ExprType.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/ExprType.java b/tajo-algebra/src/main/java/tajo/algebra/ExprType.java
deleted file mode 100644
index 9a29d99..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/ExprType.java
+++ /dev/null
@@ -1,99 +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 tajo.algebra;
-
-import com.google.gson.*;
-
-import java.lang.reflect.Type;
-
-public enum ExprType {
-  // relational operators
-  Relation(Relation.class),
-  TableSubQuery(TableSubQuery.class),
-  Except(SetOperation.class),
-	Aggregation(tajo.algebra.Aggregation.class),
-  Intersect(SetOperation.class),
-  Join(Join.class),
-  Projection(Projection.class),
-  Rename,
-  Selection(Selection.class),
-  Sort(Sort.class),
-  Union(SetOperation.class),
-  Limit(Limit.class),
-
-  // extended relational operators
-  CreateTable(CreateTable.class),
-
-  // logical operators
-  And(BinaryOperator.class),
-  Or(BinaryOperator.class),
-
-  // comparison operators
-  Equals(BinaryOperator.class),
-  NotEquals(BinaryOperator.class),
-  LessThan(BinaryOperator.class),
-  LessThanOrEquals(BinaryOperator.class),
-  GreaterThan(BinaryOperator.class),
-  GreaterThanOrEquals(BinaryOperator.class),
-
-  // arithmetic operators
-  Plus(BinaryOperator.class),
-  Minus(BinaryOperator.class),
-  Multiply(BinaryOperator.class),
-  Divide(BinaryOperator.class),
-  Mod(BinaryOperator.class),
-
-  // other expressions
-  Column(ColumnReferenceExpr.class),
-  Function(FunctionExpr.class),
-  CaseWhen(CaseWhenExpr.class),
-  Like(LikeExpr.class),
-  Literal(LiteralExpr.class),
-  ScalarSubQuery(ScalarSubQuery.class);
-
-  private Class baseClass;
-
-  ExprType() {
-    this.baseClass = Expr.class;
-  }
-  ExprType(Class clazz) {
-    this.baseClass = clazz;
-  }
-
-  public Class getBaseClass() {
-    return this.baseClass;
-  }
-
-  public static class JsonSerDer implements JsonSerializer<ExprType>,
-                                            JsonDeserializer<ExprType> {
-
-    @Override
-    public JsonElement serialize(ExprType src, Type typeOfSrc,
-                                 JsonSerializationContext context) {
-      return new JsonPrimitive(src.name());
-    }
-
-    @Override
-    public ExprType deserialize(JsonElement json, Type typeOfT,
-                                      JsonDeserializationContext context)
-        throws JsonParseException {
-      return ExprType.valueOf(json.getAsString());
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/FunctionExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/FunctionExpr.java b/tajo-algebra/src/main/java/tajo/algebra/FunctionExpr.java
deleted file mode 100644
index 5bd5d8d..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/FunctionExpr.java
+++ /dev/null
@@ -1,45 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class FunctionExpr extends Expr {
-  private String signature;
-  private Expr[] params;
-
-  public FunctionExpr(String signature) {
-    super(ExprType.Function);
-  }
-
-  public void setParams(Expr[] params) {
-    this.params = params;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    FunctionExpr another = (FunctionExpr) expr;
-    return signature.equals(another.signature) &&
-        TUtil.checkEquals(params, another.params);
-  }
-
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Join.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Join.java b/tajo-algebra/src/main/java/tajo/algebra/Join.java
deleted file mode 100644
index 6af12f9..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Join.java
+++ /dev/null
@@ -1,82 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Join extends BinaryOperator {
-  private JoinType join_type;
-  private Expr join_qual;
-  private ColumnReferenceExpr [] join_columns;
-  private boolean natural = false;
-
-  public Join(JoinType joinType) {
-    super(ExprType.Join);
-    this.join_type = joinType;
-  }
-
-  public JoinType getJoinType() {
-    return  this.join_type;
-  }
-
-  public boolean hasQual() {
-    return this.join_qual != null;
-  }
-
-  public Expr getQual() {
-    return this.join_qual;
-  }
-
-  public void setQual(Expr expr) {
-    this.join_qual = expr;
-  }
-
-  public boolean hasJoinColumns() {
-    return join_columns != null;
-  }
-
-  public ColumnReferenceExpr [] getJoinColumns() {
-    return join_columns;
-  }
-
-  public void setJoinColumns(ColumnReferenceExpr[] columns) {
-    join_columns = columns;
-  }
-
-  public void setNatural() {
-    natural = true;
-  }
-
-  public boolean isNatural() {
-    return natural;
-  }
-
-  boolean equalsTo(Expr expr) {
-    Join another = (Join) expr;
-    return join_type.equals(another.join_type) &&
-        TUtil.checkEquals(join_qual, another.join_qual) &&
-        TUtil.checkEquals(join_columns, another.join_columns) &&
-        natural == another.natural;
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/JoinType.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/JoinType.java b/tajo-algebra/src/main/java/tajo/algebra/JoinType.java
deleted file mode 100644
index 5895324..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/JoinType.java
+++ /dev/null
@@ -1,28 +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 tajo.algebra;
-
-public enum JoinType {
-  CROSS_JOIN,
-  INNER,
-  LEFT_OUTER,
-  RIGHT_OUTER,
-  FULL_OUTER,
-  UNION
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/JsonHelper.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/JsonHelper.java b/tajo-algebra/src/main/java/tajo/algebra/JsonHelper.java
deleted file mode 100644
index 29cddd4..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/JsonHelper.java
+++ /dev/null
@@ -1,57 +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 tajo.algebra;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-public class JsonHelper {
-  private static JsonHelper instance;
-
-  private GsonBuilder builder;
-  private Gson gson;
-
-  static {
-    instance = new JsonHelper();
-  }
-
-  private JsonHelper() {
-    initBuilder();
-    gson = builder.create();
-  }
-
-  private void initBuilder() {
-    builder = new GsonBuilder().setPrettyPrinting();
-    builder.registerTypeAdapter(ExprType.class, new ExprType.JsonSerDer());
-    builder.registerTypeAdapter(Expr.class, new Expr.JsonSerDer());
-  }
-
-
-  public static Gson getInstance() {
-    return instance.gson;
-  }
-
-  public static String toJson(Object obj) {
-    return instance.gson.toJson(obj);
-  }
-
-  public static <T> T fromJson(String json, Class<T> clazz) {
-    return instance.gson.fromJson(json, clazz);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/JsonSerializable.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/JsonSerializable.java b/tajo-algebra/src/main/java/tajo/algebra/JsonSerializable.java
deleted file mode 100644
index f98c054..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/JsonSerializable.java
+++ /dev/null
@@ -1,23 +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 tajo.algebra;
-
-public interface JsonSerializable {
-  String toJson();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/LikeExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/LikeExpr.java b/tajo-algebra/src/main/java/tajo/algebra/LikeExpr.java
deleted file mode 100644
index 2910c62..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/LikeExpr.java
+++ /dev/null
@@ -1,51 +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 tajo.algebra;
-
-public class LikeExpr extends BinaryOperator {
-  private boolean not;
-  private ColumnReferenceExpr column_ref;
-  private Expr pattern;
-
-  public LikeExpr(boolean not, ColumnReferenceExpr columnReferenceExpr, Expr pattern) {
-    super(ExprType.Like);
-    this.not = not;
-    this.column_ref = columnReferenceExpr;
-    this.pattern = pattern;
-  }
-
-  public boolean isNot() {
-    return not;
-  }
-
-  public ColumnReferenceExpr getColumnRef() {
-    return this.column_ref;
-  }
-
-  public Expr getPattern() {
-    return this.pattern;
-  }
-
-  boolean equalsTo(Expr expr) {
-    LikeExpr another = (LikeExpr) expr;
-    return not == another.not &&
-        column_ref.equals(another.column_ref) &&
-        pattern.equals(another.pattern);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Limit.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Limit.java b/tajo-algebra/src/main/java/tajo/algebra/Limit.java
deleted file mode 100644
index 84d88ce..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Limit.java
+++ /dev/null
@@ -1,49 +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 tajo.algebra;
-
-
-public class Limit extends UnaryOperator {
-  private Expr fetch_first_num;
-
-  public Limit(Expr fetch_first_num) {
-    super(ExprType.Limit);
-    this.fetch_first_num = fetch_first_num;
-  }
-
-  public Expr getFetchFirstNum() {
-    return this.fetch_first_num;
-  }
-
-  @Override
-  public String toString() {
-    return toJson();
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    Limit another = (Limit) expr;
-    return fetch_first_num.equals(another.fetch_first_num);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/LiteralExpr.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/LiteralExpr.java b/tajo-algebra/src/main/java/tajo/algebra/LiteralExpr.java
deleted file mode 100644
index eae0e1c..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/LiteralExpr.java
+++ /dev/null
@@ -1,53 +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 tajo.algebra;
-
-public class LiteralExpr extends Expr {
-  private String value;
-  private LiteralType value_type;
-
-  public static enum LiteralType {
-    String,
-    Unsigned_Integer,
-    Unsigned_Float,
-    Unsigned_Large_Integer,
-  }
-
-  public LiteralExpr(String value, LiteralType value_type) {
-    super(ExprType.Literal);
-    this.value = value;
-    this.value_type = value_type;
-  }
-
-  public String getValue() {
-    return this.value;
-  }
-
-  public LiteralType getValueType() {
-    return this.value_type;
-  }
-
-  public boolean equalsTo(Expr expr) {
-    LiteralExpr another = (LiteralExpr) expr;
-    boolean a = value_type.equals(another.value_type);
-    boolean b =  value.equals(another.value);
-
-    return a && b;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Projection.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Projection.java b/tajo-algebra/src/main/java/tajo/algebra/Projection.java
deleted file mode 100644
index c8b2d7f..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Projection.java
+++ /dev/null
@@ -1,68 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Projection extends UnaryOperator implements Cloneable {
-  private boolean project_all;
-  private boolean distinct = false;
-
-  private Target [] targets;
-
-  public Projection() {
-    super(ExprType.Projection);
-  }
-
-  public boolean isDistinct() {
-    return distinct;
-  }
-
-  public void setDistinct() {
-    distinct = true;
-  }
-
-  public void setAll() {
-    project_all = true;
-  }
-
-  public boolean isAllProjected() {
-    return project_all;
-  }
-	
-	public Target [] getTargets() {
-	  return this.targets;
-	}
-
-  public void setTargets(Target [] targets) {
-    this.targets = targets;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    Projection another = (Projection) expr;
-    return TUtil.checkEquals(project_all, another.project_all) &&
-        TUtil.checkEquals(targets, another.targets);
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Relation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Relation.java b/tajo-algebra/src/main/java/tajo/algebra/Relation.java
deleted file mode 100644
index bb692c2..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Relation.java
+++ /dev/null
@@ -1,70 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Relation extends Expr {
-  private String rel_name;
-  private String alias;
-
-  protected Relation(ExprType type, String relationName) {
-    super(type);
-    this.rel_name = relationName;
-  }
-
-  public Relation(String relationName) {
-    this(ExprType.Relation, relationName);
-  }
-
-  public String getName() {
-    return rel_name;
-  }
-
-  public boolean hasAlias() {
-    return alias != null;
-  }
-
-  public String getAlias() {
-    return this.alias;
-  }
-
-  public void setAlias(String alias) {
-    this.alias = alias;
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    Relation other = (Relation) expr;
-    return TUtil.checkEquals(rel_name, other.rel_name) &&
-        TUtil.checkEquals(alias, other.alias);
-  }
-
-  @Override
-  public int hashCode() {
-    int result = rel_name.hashCode();
-    result = 31 * result + (alias != null ? alias.hashCode() : 0);
-    return result;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/ScalarSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/ScalarSubQuery.java b/tajo-algebra/src/main/java/tajo/algebra/ScalarSubQuery.java
deleted file mode 100644
index 35e2a49..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/ScalarSubQuery.java
+++ /dev/null
@@ -1,41 +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 tajo.algebra;
-
-public class ScalarSubQuery extends Expr {
-  private Expr subquery;
-  public ScalarSubQuery(Expr subQuery) {
-    super(ExprType.ScalarSubQuery);
-    this.subquery = subQuery;
-  }
-
-  public Expr getSubQuery() {
-    return this.subquery;
-  }
-
-  @Override
-  boolean equalsTo(Expr expr) {
-    ScalarSubQuery another = (ScalarSubQuery) expr;
-    return subquery.equals(another);
-  }
-
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Selection.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Selection.java b/tajo-algebra/src/main/java/tajo/algebra/Selection.java
deleted file mode 100644
index 8364801..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Selection.java
+++ /dev/null
@@ -1,57 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Selection extends UnaryOperator implements JsonSerializable {
-  private Expr search_condition;
-
-  public Selection(Expr relation, Expr qual) {
-    super(ExprType.Selection);
-    setChild(relation);
-    search_condition = qual;
-  }
-
-  public boolean hasQual() {
-    return search_condition != null;
-  }
-
-  public void setQual(Expr expr) {
-    this.search_condition = expr;
-  }
-
-	public Expr getQual() {
-		return this.search_condition;
-	}
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  @Override
-  public boolean equalsTo(Expr expr) {
-    if (expr instanceof Selection) {
-      Selection other = (Selection) expr;
-      return TUtil.checkEquals(search_condition, other.search_condition);
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/SetOperation.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/SetOperation.java b/tajo-algebra/src/main/java/tajo/algebra/SetOperation.java
deleted file mode 100644
index eeff233..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/SetOperation.java
+++ /dev/null
@@ -1,46 +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 tajo.algebra;
-
-
-import com.google.common.base.Preconditions;
-
-public class SetOperation extends BinaryOperator {
-  private boolean distinct = true;
-
-  public SetOperation(ExprType type, Expr left, Expr right, boolean distinct) {
-    super(type, left, right);
-    Preconditions.checkArgument(type == ExprType.Union ||
-        type == ExprType.Intersect ||
-        type == ExprType.Except);
-  }
-
-  public boolean isDistinct() {
-    return distinct;
-  }
-
-  public void unsetDistinct() {
-    distinct = false;
-  }
-
-  boolean equalsTo(Expr expr) {
-    SetOperation another = (SetOperation) expr;
-    return distinct == another.distinct;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-algebra/src/main/java/tajo/algebra/Sort.java
----------------------------------------------------------------------
diff --git a/tajo-algebra/src/main/java/tajo/algebra/Sort.java b/tajo-algebra/src/main/java/tajo/algebra/Sort.java
deleted file mode 100644
index fb0db45..0000000
--- a/tajo-algebra/src/main/java/tajo/algebra/Sort.java
+++ /dev/null
@@ -1,103 +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 tajo.algebra;
-
-import tajo.util.TUtil;
-
-public class Sort extends UnaryOperator {
-  private SortSpec [] sort_specs;
-
-  public Sort(final SortSpec [] sortSpecs) {
-    super(ExprType.Sort);
-    this.sort_specs = sortSpecs;
-  }
-
-  public void setSortSpecs(SortSpec[] sort_specs) {
-    this.sort_specs = sort_specs;
-  }
-
-  public SortSpec [] getSortSpecs() {
-    return this.sort_specs;
-  }
-
-  @Override
-  public boolean equalsTo(Expr expr) {
-    Sort another = (Sort) expr;
-    return TUtil.checkEquals(sort_specs, another.sort_specs);
-  }
-
-  @Override
-  public String toJson() {
-    return JsonHelper.toJson(this);
-  }
-
-  public static class SortSpec {
-    private ColumnReferenceExpr key;
-    private boolean asc = true;
-    private boolean null_first = false;
-
-    public SortSpec(final ColumnReferenceExpr key) {
-      this.key = key;
-    }
-
-    /**
-     *
-     * @param sortKey a column to sort
-     * @param asc true if the sort order is ascending order
-     * @param nullFirst
-     * Otherwise, it should be false.
-     */
-    public SortSpec(final ColumnReferenceExpr sortKey, final boolean asc,
-                    final boolean nullFirst) {
-      this(sortKey);
-      this.asc = asc;
-      this.null_first = nullFirst;
-    }
-
-    public final boolean isAscending() {
-      return this.asc;
-    }
-
-    public final void setDescending() {
-      this.asc = false;
-    }
-
-    public final boolean isNullFirst() {
-      return this.null_first;
-    }
-
-    public final void setNullFirst() {
-      this.null_first = true;
-    }
-
-    public final ColumnReferenceExpr getKey() {
-      return this.key;
-    }
-
-    public boolean equals(Object obj) {
-      if (obj instanceof SortSpec) {
-        SortSpec other = (SortSpec) obj;
-        return TUtil.checkEquals(key, other.key) &&
-            TUtil.checkEquals(asc, other.asc) &&
-            TUtil.checkEquals(null_first, other.null_first);
-      }
-      return false;
-    }
-  }
-}


Mime
View raw message