You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/07/02 16:16:39 UTC

[45/51] [partial] TAJO-22: The package prefix should be org.apache.tajo. (DaeMyung Kang via hyunsik)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
new file mode 100644
index 0000000..3546612
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
@@ -0,0 +1,126 @@
+/**
+ * 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.catalog;
+
+import com.google.gson.Gson;
+import org.junit.Test;
+import org.apache.tajo.catalog.function.GeneralFunction;
+import org.apache.tajo.catalog.json.GsonCreator;
+import org.apache.tajo.catalog.proto.CatalogProtos.FunctionDescProto;
+import org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.exception.InternalException;
+import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.util.CommonTestingUtil;
+import org.apache.tajo.util.FileUtil;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.junit.Assert.*;
+
+public class TestFunctionDesc {
+  private static final String TEST_PATH = "target/test-data/TestFunctionDesc";
+
+  public static class TestSum extends GeneralFunction {
+    private Integer x;
+    private Integer y;
+
+    public TestSum() {
+      super(new Column[] { new Column("arg1", TajoDataTypes.Type.INT4),
+          new Column("arg2", TajoDataTypes.Type.INT4) });
+    }
+
+    @Override
+    public Datum eval(Tuple params) {
+      x =  params.get(0).asInt4();
+      y =  params.get(1).asInt4();
+      return DatumFactory.createInt4(x + y);
+    }
+
+    public String toJSON() {
+      return GsonCreator.getInstance().toJson(this, GeneralFunction.class);
+    }
+  }
+
+
+  @Test
+  public void testGetSignature() throws IOException {
+    FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
+    assertEquals("sum", desc.getSignature());
+    assertEquals(TestSum.class, desc.getFuncClass());
+    assertEquals(FunctionType.GENERAL, desc.getFuncType());
+    assertEquals(Type.INT4, desc.getReturnType()[0].getType());
+    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
+        desc.getParamTypes());
+
+    CommonTestingUtil.getTestDir(TEST_PATH);
+    File save = new File(TEST_PATH + "/save.dat");
+    FileUtil.writeProto(save, desc.getProto());
+
+    FunctionDescProto proto = FunctionDescProto.getDefaultInstance();
+    proto = (FunctionDescProto) FileUtil.loadProto(save, proto);
+
+    FunctionDesc newDesc = new FunctionDesc(proto);
+    assertEquals("sum", newDesc.getSignature());
+    assertEquals(TestSum.class, newDesc.getFuncClass());
+    assertEquals(FunctionType.GENERAL, newDesc.getFuncType());
+    assertEquals(Type.INT4, newDesc.getReturnType()[0].getType());
+    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
+        newDesc.getParamTypes());
+
+    assertEquals(desc.getProto(), newDesc.getProto());
+  }
+  
+  @Test
+  public void testJson() throws InternalException {
+	  FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
+	  String json = desc.toJSON();
+	  System.out.println(json);
+	  Gson gson = GsonCreator.getInstance();
+	  FunctionDesc fromJson = gson.fromJson(json, FunctionDesc.class);
+	  
+	  assertEquals("sum", fromJson.getSignature());
+	    assertEquals(TestSum.class, fromJson.getFuncClass());
+	    assertEquals(FunctionType.GENERAL, fromJson.getFuncType());
+	    assertEquals(Type.INT4, fromJson.getReturnType()[0].getType());
+	    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
+	    		fromJson.getParamTypes());
+
+	    assertEquals(desc.getProto(), fromJson.getProto());
+  }
+  
+  @Test
+  public void testClone() throws CloneNotSupportedException {
+    FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
+    FunctionDesc cloned = (FunctionDesc)desc.clone();
+    assertTrue("reference chk" , !(desc == cloned));
+    assertTrue("getClass() chk", desc.getClass() == cloned.getClass());
+    assertTrue("equals() chk", desc.equals(cloned));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestIndexDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestIndexDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestIndexDesc.java
new file mode 100644
index 0000000..6a9adc7
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestIndexDesc.java
@@ -0,0 +1,96 @@
+/**
+ * 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.catalog;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.IndexDescProto;
+import org.apache.tajo.catalog.proto.CatalogProtos.IndexMethod;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+
+public class TestIndexDesc {
+  static IndexDesc desc1;
+  static IndexDesc desc2;
+  static IndexDesc desc3;
+  
+  static {
+    desc1 = new IndexDesc(
+        "idx_test", "indexed", new Column("id", Type.INT4),
+        IndexMethod.TWO_LEVEL_BIN_TREE, true, true, true);
+    
+    desc2 = new IndexDesc(
+        "idx_test2", "indexed", new Column("score", Type.FLOAT8),
+        IndexMethod.TWO_LEVEL_BIN_TREE, false, false, false);
+    
+    desc3 = new IndexDesc(
+        "idx_test", "indexed", new Column("id", Type.INT4),
+        IndexMethod.TWO_LEVEL_BIN_TREE, true, true, true);
+  }
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @AfterClass
+  public static void tearDown() throws Exception {
+  }
+
+  @Test
+  public void testIndexDescProto() {
+    IndexDescProto proto = desc1.getProto();
+    assertEquals(desc1.getProto(), proto);
+    assertEquals(desc1, new IndexDesc(proto));
+  }
+
+  @Test
+  public void testGetFields() {
+    assertEquals("idx_test", desc1.getName());
+    assertEquals("indexed", desc1.getTableId());
+    assertEquals(new Column("id", Type.INT4), desc1.getColumn());
+    assertEquals(IndexMethod.TWO_LEVEL_BIN_TREE, desc1.getIndexMethod());
+    assertEquals(true, desc1.isUnique());
+    assertEquals(true, desc1.isClustered());
+    assertEquals(true, desc1.isAscending());
+    
+    assertEquals("idx_test2", desc2.getName());
+    assertEquals("indexed", desc2.getTableId());
+    assertEquals(new Column("score", Type.FLOAT8), desc2.getColumn());
+    assertEquals(IndexMethod.TWO_LEVEL_BIN_TREE, desc2.getIndexMethod());
+    assertEquals(false, desc2.isUnique());
+    assertEquals(false, desc2.isClustered());
+    assertEquals(false, desc2.isAscending());
+  }
+
+  @Test
+  public void testEqualsObject() {
+    assertNotSame(desc1, desc2);
+    assertEquals(desc1, desc3);
+  }
+
+  @Test
+  public void testClone() throws CloneNotSupportedException {
+    IndexDesc copy = (IndexDesc) desc1.clone();
+    assertEquals(desc1, copy);
+    assertEquals(desc3, copy);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestOptions.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestOptions.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestOptions.java
new file mode 100644
index 0000000..bcccfd3
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestOptions.java
@@ -0,0 +1,63 @@
+/**
+ * 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.catalog;
+
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.KeyValueSetProto;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class TestOptions {
+	@Test
+	public final void testPutAndGet() {
+		Options opts = new Options();
+		opts.put("name", "abc");
+		opts.put("delimiter", ",");
+		
+		assertEquals(",", opts.get("delimiter"));
+		assertEquals("abc", opts.get("name"));
+	}
+
+	@Test
+	public final void testGetProto() {		
+		Options opts = new Options();
+		opts.put("name", "abc");
+		opts.put("delimiter", ",");
+		
+		KeyValueSetProto proto = opts.getProto();
+		Options opts2 = new Options(proto);
+		
+		assertEquals(opts, opts2);
+	}
+	
+	@Test
+	public final void testDelete() {
+		Options opts = new Options();
+		opts.put("name", "abc");
+		opts.put("delimiter", ",");
+		
+		assertEquals("abc", opts.get("name"));
+		assertEquals("abc", opts.delete("name"));
+		assertNull(opts.get("name"));
+		
+		Options opts2 = new Options(opts.getProto());
+		assertNull(opts2.get("name"));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestSchema.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestSchema.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestSchema.java
new file mode 100644
index 0000000..904d4b7
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestSchema.java
@@ -0,0 +1,133 @@
+/**
+ * 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.catalog;
+
+import com.google.gson.Gson;
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.tajo.catalog.exception.AlreadyExistsFieldException;
+import org.apache.tajo.catalog.json.GsonCreator;
+import org.apache.tajo.catalog.proto.CatalogProtos.SchemaProto;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.*;
+
+public class TestSchema {
+	
+	Schema schema;
+	Column col1;
+	Column col2;
+	Column col3;
+
+	@Before
+	public void setUp() throws Exception {
+		schema = new Schema();
+		col1 = new Column("name", Type.TEXT);
+		schema.addColumn(col1);
+		col2 = new Column("age", Type.INT4);
+		schema.addColumn(col2);
+		col3 = new Column("addr", Type.TEXT);
+		schema.addColumn(col3);
+	}
+
+	@Test
+	public final void testSchemaSchema() {
+		Schema schema2 = new Schema(schema);
+		
+		assertEquals(schema, schema2);
+	}
+
+	@Test
+	public final void testSchemaSchemaProto() {
+		Schema schema2 = new Schema(schema.getProto());
+		
+		assertEquals(schema, schema2);
+	}
+
+	@Test
+	public final void testGetColumnString() {
+		assertEquals(col1, schema.getColumn("name"));
+		assertEquals(col2, schema.getColumn("age"));
+		assertEquals(col3, schema.getColumn("addr"));
+	}
+
+	@Test
+	public final void testAddField() {
+		Schema schema = new Schema();
+		assertFalse(schema.contains("studentId"));
+		schema.addColumn("studentId", Type.INT4);
+		assertTrue(schema.contains("studentId"));
+	}
+
+	@Test
+	public final void testEqualsObject() {
+		Schema schema2 = new Schema();
+		schema2.addColumn("name", Type.TEXT);
+		schema2.addColumn("age", Type.INT4);
+		schema2.addColumn("addr", Type.TEXT);
+		
+		assertEquals(schema, schema2);
+	}
+
+	@Test
+	public final void testGetProto() {
+		SchemaProto proto = schema.getProto();
+		
+		assertEquals("name", proto.getFields(0).getColumnName());
+		assertEquals("age", proto.getFields(1).getColumnName());
+		assertEquals("addr", proto.getFields(2).getColumnName());
+	}
+	
+	@Test
+	public final void testClone() throws CloneNotSupportedException {
+	  Schema schema = new Schema();
+	  schema.addColumn("abc", Type.FLOAT8);
+	  schema.addColumn("bbc", Type.FLOAT8);
+	  
+	  Schema schema2 = new Schema(schema.getProto());
+	  assertEquals(schema.getProto(), schema2.getProto());
+	  assertEquals(schema.getColumn(0), schema2.getColumn(0));
+	  assertEquals(schema.getColumnNum(), schema2.getColumnNum());
+	  
+	  Schema schema3 = (Schema) schema.clone();
+	  assertEquals(schema.getProto(), schema3.getProto());
+    assertEquals(schema.getColumn(0), schema3.getColumn(0));
+    assertEquals(schema.getColumnNum(), schema3.getColumnNum());
+	}
+	
+	@Test(expected = AlreadyExistsFieldException.class)
+	public final void testAddExistColumn() {
+    Schema schema = new Schema();
+    schema.addColumn("abc", Type.FLOAT8);
+    schema.addColumn("bbc", Type.FLOAT8);
+    schema.addColumn("abc", Type.INT4);
+	}
+
+	@Test
+	public final void testJson() {
+		Schema schema2 = new Schema(schema.getProto());
+		String json = schema2.toJson();
+		System.out.println(json);
+		Gson gson = GsonCreator.getInstance();
+		Schema fromJson = gson.fromJson(json, Schema.class);
+		assertEquals(schema2.getProto(), fromJson.getProto());
+		assertEquals(schema2.getColumn(0), fromJson.getColumn(0));
+		assertEquals(schema2.getColumnNum(), fromJson.getColumnNum());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableDesc.java
new file mode 100644
index 0000000..4816c45
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableDesc.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.catalog;
+
+import com.google.gson.Gson;
+import org.apache.hadoop.fs.Path;
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.tajo.catalog.json.GsonCreator;
+import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestTableDesc {
+	TableMeta info;
+	TableDesc desc;
+	
+	@Before
+	public void setup() {
+	  Schema schema = new Schema();
+    schema.addColumn("name", Type.BLOB);
+    schema.addColumn("addr", Type.TEXT);
+    info = CatalogUtil.newTableMeta(schema, StoreType.CSV);
+
+    desc = new TableDescImpl("table1", info, new Path("/nta/data"));
+	}
+
+  @Test
+  public void test() throws CloneNotSupportedException {
+    Schema schema = new Schema();
+    schema.addColumn("name", Type.BLOB);
+    schema.addColumn("addr", Type.TEXT);
+    TableMeta info = CatalogUtil.newTableMeta(schema, StoreType.CSV);
+    testClone(info);
+
+    TableDesc desc = new TableDescImpl("table1", info, new Path("/nta/data"));
+    assertEquals("table1", desc.getId());
+    
+    assertEquals(new Path("/nta/data"), desc.getPath());
+    assertEquals(info, desc.getMeta());
+    testClone(desc);
+  }
+  
+  @Test
+  public void testTableMetaToJson() throws CloneNotSupportedException {
+    TableMeta meta = new TableMetaImpl(info.getProto());
+    Gson gson = GsonCreator.getInstance();
+    String json = meta.toJSON();
+    System.out.println(json);
+    TableMeta jsonMeta = gson.fromJson(json, TableMeta.class);
+    assertEquals(meta.getSchema(), jsonMeta.getSchema());
+    assertEquals(meta.getStoreType(), jsonMeta.getStoreType());
+    assertEquals(meta, jsonMeta);
+    testClone(meta);
+  }
+  
+  @Test
+  public void testTableDescToJson() throws CloneNotSupportedException {
+    Gson gson = GsonCreator.getInstance();
+
+    TableDesc desc = new TableDescImpl("table1", info, new Path("/nta/data"));
+    testClone(desc);
+
+    String json = desc.toJSON();
+    System.out.println(json);
+    TableDesc fromJson = gson.fromJson(json, TableDesc.class);
+    assertEquals(desc.getId(), fromJson.getId());
+    assertEquals(desc.getPath(), fromJson.getPath());
+    assertEquals(desc.getMeta(), fromJson.getMeta());
+    testClone(fromJson);
+  }
+
+  public void testClone(TableDesc desc) throws CloneNotSupportedException {
+    TableDesc copy = (TableDesc) desc.clone();
+    assertEquals(desc, copy);
+  }
+  
+  public void testClone(TableMeta meta) throws CloneNotSupportedException {
+    TableMeta copy = (TableMeta) meta.clone();
+    assertEquals(meta, copy);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableInfo.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableInfo.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableInfo.java
new file mode 100644
index 0000000..0be3fc5
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableInfo.java
@@ -0,0 +1,129 @@
+/**
+ * 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.catalog;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
+import org.apache.tajo.catalog.proto.CatalogProtos.TableProto;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.*;
+
+public class TestTableInfo {
+  TableMeta meta = null;
+  Schema schema = null;
+  
+  @Before
+  public void setUp() {
+    schema = new Schema();
+    schema.addColumn("name", Type.BLOB);
+    schema.addColumn("addr", Type.TEXT);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
+  }
+  
+  @Test
+  public void testTableMetaTableProto() {    
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMeta meta2 = new TableMetaImpl(meta1.getProto());
+    assertEquals(meta1, meta2);
+  }
+  
+  @Test
+  public final void testClone() throws CloneNotSupportedException {    
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMetaImpl info = (TableMetaImpl) meta1;
+    
+    TableMetaImpl info2 = (TableMetaImpl) info.clone();
+    assertEquals(info.getSchema(), info2.getSchema());
+    assertEquals(info.getStoreType(), info2.getStoreType());
+    assertEquals(info, info2);
+  }
+  
+  @Test
+  public void testSchema() throws CloneNotSupportedException {    
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMeta meta2 = (TableMeta) meta1.clone();
+    
+    assertEquals(meta1, meta2);
+  }
+  
+  @Test
+  public void testGetStorageType() {
+    assertEquals(StoreType.CSV, meta.getStoreType());
+  }
+  
+  @Test
+  public void testGetSchema() {
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    
+    assertEquals(schema, schema2);
+  }
+  
+  @Test
+  public void testSetSchema() {
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    schema2.addColumn("age", Type.INT4);
+    
+    assertNotSame(meta.getSchema(), schema2);
+    meta.setSchema(schema2);
+    assertEquals(meta.getSchema(), schema2);
+  }
+  
+  @Test
+  public void testEqualsObject() {    
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    TableMeta meta2 = CatalogUtil.newTableMeta(schema2, StoreType.CSV);
+    
+    assertTrue(meta.equals(meta2));
+    
+    assertNotSame(meta, meta2);
+  }
+  
+  @Test
+  public void testGetProto() {
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableProto proto = meta1.getProto();
+    TableMeta newMeta = new TableMetaImpl(proto);
+    
+    assertTrue(meta1.equals(newMeta));
+  }   
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
new file mode 100644
index 0000000..590e343
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestTableMeta.java
@@ -0,0 +1,127 @@
+/**
+ * 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.catalog;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
+import org.apache.tajo.catalog.proto.CatalogProtos.TableProto;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.*;
+
+public class TestTableMeta {
+  TableMeta meta = null;
+  Schema schema = null;
+  
+  @Before
+  public void setUp() {    
+    schema = new Schema();
+    schema.addColumn("name", Type.BLOB);
+    schema.addColumn("addr", Type.TEXT);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
+  }
+  
+  @Test
+  public void testTableMetaTableProto() {    
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMeta meta2 = new TableMetaImpl(meta1.getProto());
+    assertEquals(meta1, meta2);
+  }
+  
+  @Test
+  public final void testClone() throws CloneNotSupportedException {
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMetaImpl meta2 = (TableMetaImpl) meta1.clone();
+    assertEquals(meta1.getSchema(), meta2.getSchema());
+    assertEquals(meta1.getStoreType(), meta2.getStoreType());
+    assertEquals(meta1, meta2);
+  }
+  
+  @Test
+  public void testSchema() throws CloneNotSupportedException {
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableMeta meta2 = (TableMeta) meta1.clone();
+    
+    assertEquals(meta1, meta2);
+  }
+  
+  @Test
+  public void testGetStorageType() {
+    assertEquals(StoreType.CSV, meta.getStoreType());
+  }
+  
+  @Test
+  public void testGetSchema() {
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    
+    assertEquals(schema, schema2);
+  }
+  
+  @Test
+  public void testSetSchema() {
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    schema2.addColumn("age", Type.INT4);
+    
+    assertNotSame(meta.getSchema(), schema2);
+    meta.setSchema(schema2);
+    assertEquals(meta.getSchema(), schema2);
+  }
+  
+  @Test
+  public void testEqualsObject() {   
+    Schema schema2 = new Schema();
+    schema2.addColumn("name", Type.BLOB);
+    schema2.addColumn("addr", Type.TEXT);
+    TableMeta meta2 = CatalogUtil.newTableMeta(schema2, StoreType.CSV);
+    
+    assertTrue(meta.equals(meta2));
+    
+    assertNotSame(meta, meta2);
+  }
+  
+  @Test
+  public void testGetProto() {    
+    Schema schema1 = new Schema();
+    schema1.addColumn("name", Type.BLOB);
+    schema1.addColumn("addr", Type.TEXT);
+    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
+    
+    TableProto proto = meta1.getProto();
+    TableMeta newMeta = new TableMetaImpl(proto);
+    
+    assertTrue(meta1.equals(newMeta));
+  }   
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestColumnStat.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestColumnStat.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestColumnStat.java
new file mode 100644
index 0000000..2f09358
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestColumnStat.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.catalog.statistics;
+
+import org.junit.Test;
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.datum.DatumFactory;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestColumnStat {
+
+  @Test
+  public final void testColumnStat() {
+    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
+    stat.setNumDistVals(1000);
+    stat.setNumNulls(999);
+    
+    assertTrue(1000 == stat.getNumDistValues());
+    assertTrue(999 == stat.getNumNulls());
+    
+    ColumnStat stat2 = new ColumnStat(stat.getProto());
+    assertTrue(1000 == stat2.getNumDistValues());
+    assertTrue(999 == stat2.getNumNulls());
+  }
+
+  @Test
+  public final void testEqualsObject() {
+    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
+    stat.setNumDistVals(1000);
+    stat.setNumNulls(999);
+    stat.setMinValue(DatumFactory.createInt8(5));
+    stat.setMaxValue(DatumFactory.createInt8(10));
+    
+    ColumnStat stat2 = new ColumnStat(stat.getProto());
+    assertEquals(stat, stat2);
+  }
+
+  @Test
+  public final void testClone() throws CloneNotSupportedException {
+    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
+    stat.setNumDistVals(1000);
+    stat.setNumNulls(999);
+    stat.setMinValue(DatumFactory.createInt8(5));
+    stat.setMaxValue(DatumFactory.createInt8(10));
+    
+    ColumnStat stat2 = (ColumnStat) stat.clone();
+    assertEquals(stat, stat2);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatSet.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatSet.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatSet.java
new file mode 100644
index 0000000..9285c8d
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatSet.java
@@ -0,0 +1,67 @@
+/**
+ * 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.catalog.statistics;
+
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.StatType;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestStatSet {
+  @Test
+  public final void testStatGroup() throws CloneNotSupportedException {
+    Stat stat = new Stat(StatType.TABLE_NUM_ROWS);
+    stat.increment();
+    stat.incrementBy(100);
+    assertEquals(101, stat.getValue());
+    
+    Stat stat2 = (Stat) stat.clone();
+    assertEquals(stat, stat2);
+    
+    Stat stat3 = new Stat(StatType.TABLE_NUM_BLOCKS);
+    stat3.increment();
+    stat3.increment();
+    stat3.increment();
+    stat3.subtract();
+    stat3.subtractBy(2);
+    stat3.increment();
+    assertEquals(1, stat3.getValue());
+    
+    StatSet group = new StatSet();
+    group.putStat(stat);
+    group.putStat(stat3);
+    
+    assertEquals(2, group.getAllStats().size());
+    assertEquals(stat, group.getStat(StatType.TABLE_NUM_ROWS));
+    assertEquals(101, group.getStat(StatType.TABLE_NUM_ROWS).getValue());
+    assertEquals(1, group.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
+    
+    StatSet group2 = new StatSet(group.getProto());
+    assertEquals(2, group2.getAllStats().size());
+    assertEquals(stat, group2.getStat(StatType.TABLE_NUM_ROWS));
+    assertEquals(101, group2.getStat(StatType.TABLE_NUM_ROWS).getValue());
+    assertEquals(1, group2.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
+    
+    StatSet group3 = (StatSet) group.clone();
+    assertEquals(2, group3.getAllStats().size());
+    assertEquals(stat, group3.getStat(StatType.TABLE_NUM_ROWS));
+    assertEquals(101, group3.getStat(StatType.TABLE_NUM_ROWS).getValue());
+    assertEquals(1, group3.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatisticsUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatisticsUtil.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatisticsUtil.java
new file mode 100644
index 0000000..8019fec
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestStatisticsUtil.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.catalog.statistics;
+
+import com.google.common.collect.Lists;
+import org.junit.Test;
+import org.apache.tajo.catalog.proto.CatalogProtos.StatType;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestStatisticsUtil {
+  @Test
+  public void testAggregate() throws CloneNotSupportedException {
+    Stat stat = new Stat(StatType.TABLE_NUM_ROWS);
+    stat.incrementBy(100); // 100
+    assertEquals(100, stat.getValue());
+    
+    Stat stat2 = (Stat) stat.clone();
+    stat2.incrementBy(100); // 200
+    assertEquals(200, stat2.getValue());
+    
+    Stat stat3 = new Stat(StatType.TABLE_NUM_BLOCKS);
+    stat3.incrementBy(50); // 50
+    assertEquals(50, stat3.getValue());
+    
+    StatSet group = new StatSet();
+    group.putStat(stat); // num of rows - 100 
+    group.putStat(stat2); // num of rows - 200
+    group.putStat(stat3); // num of blocks - 50
+    
+    // One group has 300 rows and 50 blocks, and it is cloned.
+    StatSet group2 = (StatSet) group.clone();
+    group2.getStat(StatType.TABLE_NUM_ROWS).incrementBy(100); // plus 100
+    
+    // expected that num of rows = 200 * 2 + 100, num of blocks = 50 * 2 
+    StatSet agg = StatisticsUtil.aggregateStatSet(
+        Lists.newArrayList(group, group2));
+    assertEquals(500, agg.getStat(StatType.TABLE_NUM_ROWS).getValue());
+    assertEquals(100, agg.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
+  }
+
+  @Test
+  public void testEmptyAggregate() {
+    TableStat stat1 = new TableStat();
+    TableStat stat2 = new TableStat();
+    TableStat stat3 = new TableStat();
+
+    assertNotNull(StatisticsUtil.aggregateTableStat(
+        Lists.newArrayList(stat1, stat2, stat3)));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestTableStat.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestTableStat.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestTableStat.java
new file mode 100644
index 0000000..6fdd7e2
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/statistics/TestTableStat.java
@@ -0,0 +1,74 @@
+/**
+ * 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.catalog.statistics;
+
+import org.junit.Test;
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes.Type;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestTableStat {
+  @Test
+  public final void testTableStat() throws CloneNotSupportedException {
+    TableStat stat = new TableStat();
+    stat.setNumRows(957685);
+    stat.setNumBytes(1023234);
+    stat.setNumBlocks(3123);
+    stat.setNumPartitions(5);
+    stat.setAvgRows(80000);
+        
+    int numCols = 3;
+    ColumnStat[] cols = new ColumnStat[numCols];
+    for (int i = 0; i < numCols; i++) {
+      cols[i] = new ColumnStat(new Column("col_" + i, Type.INT8));
+      cols[i].setNumDistVals(1024 * i);
+      cols[i].setNumNulls(100 * i);
+      stat.addColumnStat(cols[i]);
+    }
+    
+    assertTrue(957685 == stat.getNumRows());
+    assertTrue(1023234 == stat.getNumBytes());
+    assertTrue(3123 == stat.getNumBlocks());
+    assertTrue(5 == stat.getNumPartitions());
+    assertTrue(80000 == stat.getAvgRows());
+    assertEquals(3, stat.getColumnStats().size());
+    for (int i = 0; i < numCols; i++) {
+      assertEquals(cols[i], stat.getColumnStats().get(i));
+    }
+    
+    TableStat stat2 = new TableStat(stat.getProto());
+    tableStatEquals(stat, stat2);
+    
+    TableStat stat3 = (TableStat) stat.clone();
+    tableStatEquals(stat, stat3);    
+  }
+  
+  public void tableStatEquals(TableStat s1, TableStat s2) {
+    assertEquals(s1.getNumRows(), s2.getNumRows());
+    assertEquals(s1.getNumBlocks(), s2.getNumBlocks());
+    assertEquals(s1.getNumPartitions(), s2.getNumPartitions());
+    assertEquals(s1.getAvgRows(), s2.getAvgRows());
+    assertEquals(s1.getColumnStats().size(), s2.getColumnStats().size());
+    for (int i = 0; i < s1.getColumnStats().size(); i++) {
+      assertEquals(s1.getColumnStats().get(i), s2.getColumnStats().get(i));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestCatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestCatalogUtil.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestCatalogUtil.java
deleted file mode 100644
index a5a2279..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestCatalogUtil.java
+++ /dev/null
@@ -1,33 +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.catalog;
-
-import org.junit.Test;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestCatalogUtil {
-  @Test
-  public final void testGetCanonicalName() {
-    String canonical = CatalogUtil.getCanonicalName("sum",
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4,  Type.INT8));
-    assertEquals("sum(INT4,INT8)", canonical);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestColumn.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestColumn.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestColumn.java
deleted file mode 100644
index f434573..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestColumn.java
+++ /dev/null
@@ -1,96 +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.catalog;
-
-import com.google.gson.Gson;
-import org.junit.Before;
-import org.junit.Test;
-import tajo.catalog.json.GsonCreator;
-import tajo.common.TajoDataTypes.DataType;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class TestColumn {
-	static final String FieldName1="f1";
-	static final String FieldName2="f2";
-	static final String FieldName3="f3";	
-	
-	static final DataType Type1 = CatalogUtil.newDataTypeWithoutLen(Type.BLOB);
-	static final DataType Type2 = CatalogUtil.newDataTypeWithoutLen(Type.INT4);
-	static final DataType Type3 = CatalogUtil.newDataTypeWithoutLen(Type.INT8);
-	
-	Column field1;
-	Column field2;
-	Column field3;
-	
-	@Before
-	public void setUp() {
-		field1 = new Column(FieldName1, Type.BLOB);
-		field2 = new Column(FieldName2, Type.INT4);
-		field3 = new Column(FieldName3, Type.INT8);
-	}
-	
-	@Test
-	public final void testFieldType() {
-		Column field1 = new Column(FieldName1, Type1);
-		Column field2 = new Column(FieldName2, Type2);
-		Column field3 = new Column(FieldName3, Type3);
-		
-		assertEquals(field1.getDataType(), Type1);		
-		assertEquals(field2.getDataType(), Type2);
-		assertEquals(field3.getDataType(), Type3);		
-	}
-
-	@Test
-	public final void testGetFieldName() {
-		assertEquals(field1.getQualifiedName(),FieldName1);
-		assertEquals(field2.getQualifiedName(),FieldName2);
-		assertEquals(field3.getQualifiedName(),FieldName3);
-	}
-
-	@Test
-	public final void testGetFieldType() {
-		assertEquals(field1.getDataType(),Type1);
-		assertEquals(field2.getDataType(),Type2);
-		assertEquals(field3.getDataType(),Type3);
-	}
-	
-	@Test
-	public final void testQualifiedName() {
-	  Column col = new Column("table_1.id", Type.INT4);
-	  
-	  assertTrue(col.isQualified());
-	  assertEquals("id", col.getColumnName());
-	  assertEquals("table_1.id", col.getQualifiedName());
-	  assertEquals("table_1", col.getTableName());
-	}
-
-	@Test
-	public final void testToJson() {
-		Column col = new Column(field1.getProto());
-		String json = col.toJSON();
-		System.out.println(json);
-		Gson gson = GsonCreator.getInstance();
-		Column fromJson = gson.fromJson(json, Column.class);
-		assertEquals(col.getColumnName(), fromJson.getColumnName());
-		assertEquals(col.getDataType(), fromJson.getDataType());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestFunctionDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestFunctionDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestFunctionDesc.java
deleted file mode 100644
index 33b1de1..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestFunctionDesc.java
+++ /dev/null
@@ -1,126 +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.catalog;
-
-import com.google.gson.Gson;
-import org.junit.Test;
-import tajo.catalog.function.GeneralFunction;
-import tajo.catalog.json.GsonCreator;
-import tajo.catalog.proto.CatalogProtos.FunctionDescProto;
-import tajo.catalog.proto.CatalogProtos.FunctionType;
-import tajo.common.TajoDataTypes;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-import tajo.exception.InternalException;
-import tajo.storage.Tuple;
-import tajo.util.CommonTestingUtil;
-import tajo.util.FileUtil;
-
-import java.io.File;
-import java.io.IOException;
-
-import static org.junit.Assert.*;
-
-public class TestFunctionDesc {
-  private static final String TEST_PATH = "target/test-data/TestFunctionDesc";
-
-  public static class TestSum extends GeneralFunction {
-    private Integer x;
-    private Integer y;
-
-    public TestSum() {
-      super(new Column[] { new Column("arg1", TajoDataTypes.Type.INT4),
-          new Column("arg2", TajoDataTypes.Type.INT4) });
-    }
-
-    @Override
-    public Datum eval(Tuple params) {
-      x =  params.get(0).asInt4();
-      y =  params.get(1).asInt4();
-      return DatumFactory.createInt4(x + y);
-    }
-
-    public String toJSON() {
-      return GsonCreator.getInstance().toJson(this, GeneralFunction.class);
-    }
-  }
-
-
-  @Test
-  public void testGetSignature() throws IOException {
-    FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
-    assertEquals("sum", desc.getSignature());
-    assertEquals(TestSum.class, desc.getFuncClass());
-    assertEquals(FunctionType.GENERAL, desc.getFuncType());
-    assertEquals(Type.INT4, desc.getReturnType()[0].getType());
-    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
-        desc.getParamTypes());
-
-    CommonTestingUtil.getTestDir(TEST_PATH);
-    File save = new File(TEST_PATH + "/save.dat");
-    FileUtil.writeProto(save, desc.getProto());
-
-    FunctionDescProto proto = FunctionDescProto.getDefaultInstance();
-    proto = (FunctionDescProto) FileUtil.loadProto(save, proto);
-
-    FunctionDesc newDesc = new FunctionDesc(proto);
-    assertEquals("sum", newDesc.getSignature());
-    assertEquals(TestSum.class, newDesc.getFuncClass());
-    assertEquals(FunctionType.GENERAL, newDesc.getFuncType());
-    assertEquals(Type.INT4, newDesc.getReturnType()[0].getType());
-    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
-        newDesc.getParamTypes());
-
-    assertEquals(desc.getProto(), newDesc.getProto());
-  }
-  
-  @Test
-  public void testJson() throws InternalException {
-	  FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
-	  String json = desc.toJSON();
-	  System.out.println(json);
-	  Gson gson = GsonCreator.getInstance();
-	  FunctionDesc fromJson = gson.fromJson(json, FunctionDesc.class);
-	  
-	  assertEquals("sum", fromJson.getSignature());
-	    assertEquals(TestSum.class, fromJson.getFuncClass());
-	    assertEquals(FunctionType.GENERAL, fromJson.getFuncType());
-	    assertEquals(Type.INT4, fromJson.getReturnType()[0].getType());
-	    assertArrayEquals(CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8),
-	    		fromJson.getParamTypes());
-
-	    assertEquals(desc.getProto(), fromJson.getProto());
-  }
-  
-  @Test
-  public void testClone() throws CloneNotSupportedException {
-    FunctionDesc desc = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
-        CatalogUtil.newDataTypesWithoutLen(Type.INT4, Type.INT8));
-    FunctionDesc cloned = (FunctionDesc)desc.clone();
-    assertTrue("reference chk" , !(desc == cloned));
-    assertTrue("getClass() chk", desc.getClass() == cloned.getClass());
-    assertTrue("equals() chk", desc.equals(cloned));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestIndexDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestIndexDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestIndexDesc.java
deleted file mode 100644
index c8eb166..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestIndexDesc.java
+++ /dev/null
@@ -1,96 +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.catalog;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.IndexDescProto;
-import tajo.catalog.proto.CatalogProtos.IndexMethod;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-
-public class TestIndexDesc {
-  static IndexDesc desc1;
-  static IndexDesc desc2;
-  static IndexDesc desc3;
-  
-  static {
-    desc1 = new IndexDesc(
-        "idx_test", "indexed", new Column("id", Type.INT4),
-        IndexMethod.TWO_LEVEL_BIN_TREE, true, true, true);
-    
-    desc2 = new IndexDesc(
-        "idx_test2", "indexed", new Column("score", Type.FLOAT8),
-        IndexMethod.TWO_LEVEL_BIN_TREE, false, false, false);
-    
-    desc3 = new IndexDesc(
-        "idx_test", "indexed", new Column("id", Type.INT4),
-        IndexMethod.TWO_LEVEL_BIN_TREE, true, true, true);
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-  }
-
-  @Test
-  public void testIndexDescProto() {
-    IndexDescProto proto = desc1.getProto();
-    assertEquals(desc1.getProto(), proto);
-    assertEquals(desc1, new IndexDesc(proto));
-  }
-
-  @Test
-  public void testGetFields() {
-    assertEquals("idx_test", desc1.getName());
-    assertEquals("indexed", desc1.getTableId());
-    assertEquals(new Column("id", Type.INT4), desc1.getColumn());
-    assertEquals(IndexMethod.TWO_LEVEL_BIN_TREE, desc1.getIndexMethod());
-    assertEquals(true, desc1.isUnique());
-    assertEquals(true, desc1.isClustered());
-    assertEquals(true, desc1.isAscending());
-    
-    assertEquals("idx_test2", desc2.getName());
-    assertEquals("indexed", desc2.getTableId());
-    assertEquals(new Column("score", Type.FLOAT8), desc2.getColumn());
-    assertEquals(IndexMethod.TWO_LEVEL_BIN_TREE, desc2.getIndexMethod());
-    assertEquals(false, desc2.isUnique());
-    assertEquals(false, desc2.isClustered());
-    assertEquals(false, desc2.isAscending());
-  }
-
-  @Test
-  public void testEqualsObject() {
-    assertNotSame(desc1, desc2);
-    assertEquals(desc1, desc3);
-  }
-
-  @Test
-  public void testClone() throws CloneNotSupportedException {
-    IndexDesc copy = (IndexDesc) desc1.clone();
-    assertEquals(desc1, copy);
-    assertEquals(desc3, copy);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestOptions.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestOptions.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestOptions.java
deleted file mode 100644
index 045e8c7..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestOptions.java
+++ /dev/null
@@ -1,63 +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.catalog;
-
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.KeyValueSetProto;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-public class TestOptions {
-	@Test
-	public final void testPutAndGet() {
-		Options opts = new Options();
-		opts.put("name", "abc");
-		opts.put("delimiter", ",");
-		
-		assertEquals(",", opts.get("delimiter"));
-		assertEquals("abc", opts.get("name"));
-	}
-
-	@Test
-	public final void testGetProto() {		
-		Options opts = new Options();
-		opts.put("name", "abc");
-		opts.put("delimiter", ",");
-		
-		KeyValueSetProto proto = opts.getProto();
-		Options opts2 = new Options(proto);
-		
-		assertEquals(opts, opts2);
-	}
-	
-	@Test
-	public final void testDelete() {
-		Options opts = new Options();
-		opts.put("name", "abc");
-		opts.put("delimiter", ",");
-		
-		assertEquals("abc", opts.get("name"));
-		assertEquals("abc", opts.delete("name"));
-		assertNull(opts.get("name"));
-		
-		Options opts2 = new Options(opts.getProto());
-		assertNull(opts2.get("name"));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestSchema.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestSchema.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestSchema.java
deleted file mode 100644
index e23790b..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestSchema.java
+++ /dev/null
@@ -1,133 +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.catalog;
-
-import com.google.gson.Gson;
-import org.junit.Before;
-import org.junit.Test;
-import tajo.catalog.exception.AlreadyExistsFieldException;
-import tajo.catalog.json.GsonCreator;
-import tajo.catalog.proto.CatalogProtos.SchemaProto;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.*;
-
-public class TestSchema {
-	
-	Schema schema;
-	Column col1;
-	Column col2;
-	Column col3;
-
-	@Before
-	public void setUp() throws Exception {
-		schema = new Schema();
-		col1 = new Column("name", Type.TEXT);
-		schema.addColumn(col1);
-		col2 = new Column("age", Type.INT4);
-		schema.addColumn(col2);
-		col3 = new Column("addr", Type.TEXT);
-		schema.addColumn(col3);
-	}
-
-	@Test
-	public final void testSchemaSchema() {
-		Schema schema2 = new Schema(schema);
-		
-		assertEquals(schema, schema2);
-	}
-
-	@Test
-	public final void testSchemaSchemaProto() {
-		Schema schema2 = new Schema(schema.getProto());
-		
-		assertEquals(schema, schema2);
-	}
-
-	@Test
-	public final void testGetColumnString() {
-		assertEquals(col1, schema.getColumn("name"));
-		assertEquals(col2, schema.getColumn("age"));
-		assertEquals(col3, schema.getColumn("addr"));
-	}
-
-	@Test
-	public final void testAddField() {
-		Schema schema = new Schema();
-		assertFalse(schema.contains("studentId"));
-		schema.addColumn("studentId", Type.INT4);
-		assertTrue(schema.contains("studentId"));
-	}
-
-	@Test
-	public final void testEqualsObject() {
-		Schema schema2 = new Schema();
-		schema2.addColumn("name", Type.TEXT);
-		schema2.addColumn("age", Type.INT4);
-		schema2.addColumn("addr", Type.TEXT);
-		
-		assertEquals(schema, schema2);
-	}
-
-	@Test
-	public final void testGetProto() {
-		SchemaProto proto = schema.getProto();
-		
-		assertEquals("name", proto.getFields(0).getColumnName());
-		assertEquals("age", proto.getFields(1).getColumnName());
-		assertEquals("addr", proto.getFields(2).getColumnName());
-	}
-	
-	@Test
-	public final void testClone() throws CloneNotSupportedException {
-	  Schema schema = new Schema();
-	  schema.addColumn("abc", Type.FLOAT8);
-	  schema.addColumn("bbc", Type.FLOAT8);
-	  
-	  Schema schema2 = new Schema(schema.getProto());
-	  assertEquals(schema.getProto(), schema2.getProto());
-	  assertEquals(schema.getColumn(0), schema2.getColumn(0));
-	  assertEquals(schema.getColumnNum(), schema2.getColumnNum());
-	  
-	  Schema schema3 = (Schema) schema.clone();
-	  assertEquals(schema.getProto(), schema3.getProto());
-    assertEquals(schema.getColumn(0), schema3.getColumn(0));
-    assertEquals(schema.getColumnNum(), schema3.getColumnNum());
-	}
-	
-	@Test(expected = AlreadyExistsFieldException.class)
-	public final void testAddExistColumn() {
-    Schema schema = new Schema();
-    schema.addColumn("abc", Type.FLOAT8);
-    schema.addColumn("bbc", Type.FLOAT8);
-    schema.addColumn("abc", Type.INT4);
-	}
-
-	@Test
-	public final void testJson() {
-		Schema schema2 = new Schema(schema.getProto());
-		String json = schema2.toJson();
-		System.out.println(json);
-		Gson gson = GsonCreator.getInstance();
-		Schema fromJson = gson.fromJson(json, Schema.class);
-		assertEquals(schema2.getProto(), fromJson.getProto());
-		assertEquals(schema2.getColumn(0), fromJson.getColumn(0));
-		assertEquals(schema2.getColumnNum(), fromJson.getColumnNum());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableDesc.java
deleted file mode 100644
index 23e6dbc..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableDesc.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.catalog;
-
-import com.google.gson.Gson;
-import org.apache.hadoop.fs.Path;
-import org.junit.Before;
-import org.junit.Test;
-import tajo.catalog.json.GsonCreator;
-import tajo.catalog.proto.CatalogProtos.StoreType;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestTableDesc {
-	TableMeta info;
-	TableDesc desc;
-	
-	@Before
-	public void setup() {
-	  Schema schema = new Schema();
-    schema.addColumn("name", Type.BLOB);
-    schema.addColumn("addr", Type.TEXT);
-    info = CatalogUtil.newTableMeta(schema, StoreType.CSV);
-
-    desc = new TableDescImpl("table1", info, new Path("/nta/data"));
-	}
-
-  @Test
-  public void test() throws CloneNotSupportedException {
-    Schema schema = new Schema();
-    schema.addColumn("name", Type.BLOB);
-    schema.addColumn("addr", Type.TEXT);
-    TableMeta info = CatalogUtil.newTableMeta(schema, StoreType.CSV);
-    testClone(info);
-
-    TableDesc desc = new TableDescImpl("table1", info, new Path("/nta/data"));
-    assertEquals("table1", desc.getId());
-    
-    assertEquals(new Path("/nta/data"), desc.getPath());
-    assertEquals(info, desc.getMeta());
-    testClone(desc);
-  }
-  
-  @Test
-  public void testTableMetaToJson() throws CloneNotSupportedException {
-    TableMeta meta = new TableMetaImpl(info.getProto());
-    Gson gson = GsonCreator.getInstance();
-    String json = meta.toJSON();
-    System.out.println(json);
-    TableMeta jsonMeta = gson.fromJson(json, TableMeta.class);
-    assertEquals(meta.getSchema(), jsonMeta.getSchema());
-    assertEquals(meta.getStoreType(), jsonMeta.getStoreType());
-    assertEquals(meta, jsonMeta);
-    testClone(meta);
-  }
-  
-  @Test
-  public void testTableDescToJson() throws CloneNotSupportedException {
-    Gson gson = GsonCreator.getInstance();
-
-    TableDesc desc = new TableDescImpl("table1", info, new Path("/nta/data"));
-    testClone(desc);
-
-    String json = desc.toJSON();
-    System.out.println(json);
-    TableDesc fromJson = gson.fromJson(json, TableDesc.class);
-    assertEquals(desc.getId(), fromJson.getId());
-    assertEquals(desc.getPath(), fromJson.getPath());
-    assertEquals(desc.getMeta(), fromJson.getMeta());
-    testClone(fromJson);
-  }
-
-  public void testClone(TableDesc desc) throws CloneNotSupportedException {
-    TableDesc copy = (TableDesc) desc.clone();
-    assertEquals(desc, copy);
-  }
-  
-  public void testClone(TableMeta meta) throws CloneNotSupportedException {
-    TableMeta copy = (TableMeta) meta.clone();
-    assertEquals(meta, copy);
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableInfo.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableInfo.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableInfo.java
deleted file mode 100644
index 6b0e1e5..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableInfo.java
+++ /dev/null
@@ -1,129 +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.catalog;
-
-import org.junit.Before;
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.StoreType;
-import tajo.catalog.proto.CatalogProtos.TableProto;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.*;
-
-public class TestTableInfo {
-  TableMeta meta = null;
-  Schema schema = null;
-  
-  @Before
-  public void setUp() {
-    schema = new Schema();
-    schema.addColumn("name", Type.BLOB);
-    schema.addColumn("addr", Type.TEXT);
-    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
-  }
-  
-  @Test
-  public void testTableMetaTableProto() {    
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMeta meta2 = new TableMetaImpl(meta1.getProto());
-    assertEquals(meta1, meta2);
-  }
-  
-  @Test
-  public final void testClone() throws CloneNotSupportedException {    
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMetaImpl info = (TableMetaImpl) meta1;
-    
-    TableMetaImpl info2 = (TableMetaImpl) info.clone();
-    assertEquals(info.getSchema(), info2.getSchema());
-    assertEquals(info.getStoreType(), info2.getStoreType());
-    assertEquals(info, info2);
-  }
-  
-  @Test
-  public void testSchema() throws CloneNotSupportedException {    
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMeta meta2 = (TableMeta) meta1.clone();
-    
-    assertEquals(meta1, meta2);
-  }
-  
-  @Test
-  public void testGetStorageType() {
-    assertEquals(StoreType.CSV, meta.getStoreType());
-  }
-  
-  @Test
-  public void testGetSchema() {
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    
-    assertEquals(schema, schema2);
-  }
-  
-  @Test
-  public void testSetSchema() {
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    schema2.addColumn("age", Type.INT4);
-    
-    assertNotSame(meta.getSchema(), schema2);
-    meta.setSchema(schema2);
-    assertEquals(meta.getSchema(), schema2);
-  }
-  
-  @Test
-  public void testEqualsObject() {    
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    TableMeta meta2 = CatalogUtil.newTableMeta(schema2, StoreType.CSV);
-    
-    assertTrue(meta.equals(meta2));
-    
-    assertNotSame(meta, meta2);
-  }
-  
-  @Test
-  public void testGetProto() {
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableProto proto = meta1.getProto();
-    TableMeta newMeta = new TableMetaImpl(proto);
-    
-    assertTrue(meta1.equals(newMeta));
-  }   
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableMeta.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableMeta.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableMeta.java
deleted file mode 100644
index d393f32..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/TestTableMeta.java
+++ /dev/null
@@ -1,127 +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.catalog;
-
-import org.junit.Before;
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.StoreType;
-import tajo.catalog.proto.CatalogProtos.TableProto;
-import tajo.common.TajoDataTypes.Type;
-
-import static org.junit.Assert.*;
-
-public class TestTableMeta {
-  TableMeta meta = null;
-  Schema schema = null;
-  
-  @Before
-  public void setUp() {    
-    schema = new Schema();
-    schema.addColumn("name", Type.BLOB);
-    schema.addColumn("addr", Type.TEXT);
-    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
-  }
-  
-  @Test
-  public void testTableMetaTableProto() {    
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMeta meta2 = new TableMetaImpl(meta1.getProto());
-    assertEquals(meta1, meta2);
-  }
-  
-  @Test
-  public final void testClone() throws CloneNotSupportedException {
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMetaImpl meta2 = (TableMetaImpl) meta1.clone();
-    assertEquals(meta1.getSchema(), meta2.getSchema());
-    assertEquals(meta1.getStoreType(), meta2.getStoreType());
-    assertEquals(meta1, meta2);
-  }
-  
-  @Test
-  public void testSchema() throws CloneNotSupportedException {
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableMeta meta2 = (TableMeta) meta1.clone();
-    
-    assertEquals(meta1, meta2);
-  }
-  
-  @Test
-  public void testGetStorageType() {
-    assertEquals(StoreType.CSV, meta.getStoreType());
-  }
-  
-  @Test
-  public void testGetSchema() {
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    
-    assertEquals(schema, schema2);
-  }
-  
-  @Test
-  public void testSetSchema() {
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    schema2.addColumn("age", Type.INT4);
-    
-    assertNotSame(meta.getSchema(), schema2);
-    meta.setSchema(schema2);
-    assertEquals(meta.getSchema(), schema2);
-  }
-  
-  @Test
-  public void testEqualsObject() {   
-    Schema schema2 = new Schema();
-    schema2.addColumn("name", Type.BLOB);
-    schema2.addColumn("addr", Type.TEXT);
-    TableMeta meta2 = CatalogUtil.newTableMeta(schema2, StoreType.CSV);
-    
-    assertTrue(meta.equals(meta2));
-    
-    assertNotSame(meta, meta2);
-  }
-  
-  @Test
-  public void testGetProto() {    
-    Schema schema1 = new Schema();
-    schema1.addColumn("name", Type.BLOB);
-    schema1.addColumn("addr", Type.TEXT);
-    TableMeta meta1 = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
-    
-    TableProto proto = meta1.getProto();
-    TableMeta newMeta = new TableMetaImpl(proto);
-    
-    assertTrue(meta1.equals(newMeta));
-  }   
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestColumnStat.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestColumnStat.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestColumnStat.java
deleted file mode 100644
index cffd42f..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestColumnStat.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.catalog.statistics;
-
-import org.junit.Test;
-import tajo.catalog.Column;
-import tajo.common.TajoDataTypes.Type;
-import tajo.datum.DatumFactory;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class TestColumnStat {
-
-  @Test
-  public final void testColumnStat() {
-    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
-    stat.setNumDistVals(1000);
-    stat.setNumNulls(999);
-    
-    assertTrue(1000 == stat.getNumDistValues());
-    assertTrue(999 == stat.getNumNulls());
-    
-    ColumnStat stat2 = new ColumnStat(stat.getProto());
-    assertTrue(1000 == stat2.getNumDistValues());
-    assertTrue(999 == stat2.getNumNulls());
-  }
-
-  @Test
-  public final void testEqualsObject() {
-    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
-    stat.setNumDistVals(1000);
-    stat.setNumNulls(999);
-    stat.setMinValue(DatumFactory.createInt8(5));
-    stat.setMaxValue(DatumFactory.createInt8(10));
-    
-    ColumnStat stat2 = new ColumnStat(stat.getProto());
-    assertEquals(stat, stat2);
-  }
-
-  @Test
-  public final void testClone() throws CloneNotSupportedException {
-    ColumnStat stat = new ColumnStat(new Column("test", Type.INT8));
-    stat.setNumDistVals(1000);
-    stat.setNumNulls(999);
-    stat.setMinValue(DatumFactory.createInt8(5));
-    stat.setMaxValue(DatumFactory.createInt8(10));
-    
-    ColumnStat stat2 = (ColumnStat) stat.clone();
-    assertEquals(stat, stat2);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatSet.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatSet.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatSet.java
deleted file mode 100644
index 3b03ddf..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatSet.java
+++ /dev/null
@@ -1,67 +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.catalog.statistics;
-
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.StatType;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestStatSet {
-  @Test
-  public final void testStatGroup() throws CloneNotSupportedException {
-    Stat stat = new Stat(StatType.TABLE_NUM_ROWS);
-    stat.increment();
-    stat.incrementBy(100);
-    assertEquals(101, stat.getValue());
-    
-    Stat stat2 = (Stat) stat.clone();
-    assertEquals(stat, stat2);
-    
-    Stat stat3 = new Stat(StatType.TABLE_NUM_BLOCKS);
-    stat3.increment();
-    stat3.increment();
-    stat3.increment();
-    stat3.subtract();
-    stat3.subtractBy(2);
-    stat3.increment();
-    assertEquals(1, stat3.getValue());
-    
-    StatSet group = new StatSet();
-    group.putStat(stat);
-    group.putStat(stat3);
-    
-    assertEquals(2, group.getAllStats().size());
-    assertEquals(stat, group.getStat(StatType.TABLE_NUM_ROWS));
-    assertEquals(101, group.getStat(StatType.TABLE_NUM_ROWS).getValue());
-    assertEquals(1, group.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
-    
-    StatSet group2 = new StatSet(group.getProto());
-    assertEquals(2, group2.getAllStats().size());
-    assertEquals(stat, group2.getStat(StatType.TABLE_NUM_ROWS));
-    assertEquals(101, group2.getStat(StatType.TABLE_NUM_ROWS).getValue());
-    assertEquals(1, group2.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
-    
-    StatSet group3 = (StatSet) group.clone();
-    assertEquals(2, group3.getAllStats().size());
-    assertEquals(stat, group3.getStat(StatType.TABLE_NUM_ROWS));
-    assertEquals(101, group3.getStat(StatType.TABLE_NUM_ROWS).getValue());
-    assertEquals(1, group3.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/bc6359b8/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatisticsUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatisticsUtil.java b/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatisticsUtil.java
deleted file mode 100644
index 9fa2d6e..0000000
--- a/tajo-catalog/tajo-catalog-common/src/test/java/tajo/catalog/statistics/TestStatisticsUtil.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.catalog.statistics;
-
-import com.google.common.collect.Lists;
-import org.junit.Test;
-import tajo.catalog.proto.CatalogProtos.StatType;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class TestStatisticsUtil {
-  @Test
-  public void testAggregate() throws CloneNotSupportedException {
-    Stat stat = new Stat(StatType.TABLE_NUM_ROWS);
-    stat.incrementBy(100); // 100
-    assertEquals(100, stat.getValue());
-    
-    Stat stat2 = (Stat) stat.clone();
-    stat2.incrementBy(100); // 200
-    assertEquals(200, stat2.getValue());
-    
-    Stat stat3 = new Stat(StatType.TABLE_NUM_BLOCKS);
-    stat3.incrementBy(50); // 50
-    assertEquals(50, stat3.getValue());
-    
-    StatSet group = new StatSet();
-    group.putStat(stat); // num of rows - 100 
-    group.putStat(stat2); // num of rows - 200
-    group.putStat(stat3); // num of blocks - 50
-    
-    // One group has 300 rows and 50 blocks, and it is cloned.
-    StatSet group2 = (StatSet) group.clone();
-    group2.getStat(StatType.TABLE_NUM_ROWS).incrementBy(100); // plus 100
-    
-    // expected that num of rows = 200 * 2 + 100, num of blocks = 50 * 2 
-    StatSet agg = StatisticsUtil.aggregateStatSet(
-        Lists.newArrayList(group, group2));
-    assertEquals(500, agg.getStat(StatType.TABLE_NUM_ROWS).getValue());
-    assertEquals(100, agg.getStat(StatType.TABLE_NUM_BLOCKS).getValue());
-  }
-
-  @Test
-  public void testEmptyAggregate() {
-    TableStat stat1 = new TableStat();
-    TableStat stat2 = new TableStat();
-    TableStat stat3 = new TableStat();
-
-    assertNotNull(StatisticsUtil.aggregateTableStat(
-        Lists.newArrayList(stat1, stat2, stat3)));
-  }
-}