tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [1/2] tajo git commit: TAJO-2154: Refactor Datum to use new Type implementation.
Date Mon, 23 May 2016 03:08:42 GMT
Repository: tajo
Updated Branches:
  refs/heads/master d819beee4 -> 132124955


http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestCharDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestCharDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestCharDatum.java
index bb22d5c..e8b2999 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestCharDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestCharDatum.java
@@ -18,9 +18,9 @@
 
 package org.apache.tajo.datum;
 
+import org.apache.tajo.type.Type;
 import org.junit.Test;
 
-import static org.apache.tajo.common.TajoDataTypes.Type;
 import static org.junit.Assert.*;
 
 public class TestCharDatum {
@@ -28,7 +28,7 @@ public class TestCharDatum {
 	@Test
 	public final void testType() {
 		Datum d = DatumFactory.createChar((char) 1);
-		assertEquals(Type.CHAR, d.type());
+		assertEquals(Type.Char(1), d.type());
 	}
 
 	@Test

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestDateDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestDateDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestDateDatum.java
index c7014a6..9e289e9 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestDateDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestDateDatum.java
@@ -18,23 +18,17 @@
 
 package org.apache.tajo.datum;
 
-import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.json.CommonGsonHelper;
+import org.apache.tajo.type.Type;
 import org.junit.Test;
 
+import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
 
 public class TestDateDatum {
   private static String DATE = "1980-04-01";
 
-	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createDate(DATE);
-    assertEquals(Type.DATE, d.type());
-	}
-
   @Test
 	public final void testAsInt4() {
     Datum d = DatumFactory.createDate(DATE);

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestDatum.java
index 9a0b654..2e71a0f 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestDatum.java
@@ -18,8 +18,8 @@
 
 package org.apache.tajo.datum;
 
+import org.apache.tajo.type.Type;
 import org.junit.Test;
-import org.apache.tajo.common.TajoDataTypes.Type;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -35,35 +35,35 @@ public class TestDatum {
 		x = DatumFactory.createInt4(1);
 		y = DatumFactory.createInt4(2);
 		z = x.plus(y);
-		assertEquals(z.type(), Type.INT4);
+		assertEquals(z.type(), Type.Int4);
 		assertEquals(z.asInt4(),3);
 		z = y.plus(x);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertEquals(z.asInt4(),3);
 		
 		x = DatumFactory.createInt4(1);
 		y = DatumFactory.createInt8(2l);
 		z = x.plus(y);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),3l);
 		z = y.plus(x);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),3l);
 		
 		y = DatumFactory.createFloat4(2.5f);
 		z = x.plus(y);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 3.5f);
 		z = y.plus(x);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertEquals(z.asInt4(),3);
 		
 		y = DatumFactory.createFloat8(4.5d);
 		z = x.plus(y);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 5.5d);
 		z = y.plus(x);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 5.5d);
 	}
 
@@ -76,34 +76,34 @@ public class TestDatum {
 		x = DatumFactory.createInt4(5);
 		y = DatumFactory.createInt4(2);
 		z = x.minus(y);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertEquals(z.asInt4(),3);
 		z = y.minus(x);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertEquals(z.asInt4(),-3);
 		
 		y = DatumFactory.createInt8(2l);
 		z = x.minus(y);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),3l);
 		z = y.minus(x);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),-3l);
 		
 		y = DatumFactory.createFloat4(2.5f);
 		z = x.minus(y);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 2.5f);
 		z = y.minus(x);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == -2.5f);
 		
 		y = DatumFactory.createFloat8(4.5d);
 		z = x.minus(y);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 0.5d);
 		z = y.minus(x);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == -0.5d);
 	}
 
@@ -116,34 +116,34 @@ public class TestDatum {
 		x = DatumFactory.createInt4(5);
 		y = DatumFactory.createInt4(2);
 		z = x.multiply(y);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertEquals(z.asInt4(),10);
 		z = y.multiply(x);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertEquals(z.asInt4(),10);
 		
 		y = DatumFactory.createInt8(2l);
 		z = x.multiply(y);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),10l);
 		z = y.multiply(x);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),10l);
 		
 		y = DatumFactory.createFloat4(2.5f);
 		z = x.multiply(y);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 12.5f);
 		z = y.multiply(x);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 12.5f);
 		
 		y = DatumFactory.createFloat8(4.5d);
 		z = x.multiply(y);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 22.5d);
 		z = y.multiply(x);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 22.5d);
 	}
 
@@ -156,34 +156,34 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.divide(y);
-		assertEquals(z.type(), Type.INT4);
+		assertEquals(z.type(), Type.Int4);
 		assertEquals(z.asInt4(),2);
 		z = y.divide(x);
-		assertEquals(z.type(),Type.INT4);
+		assertEquals(z.type(),Type.Int4);
 		assertTrue(z.asInt4() == 0);
 		
 		y = DatumFactory.createInt8(3l);
 		z = x.divide(y);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),2l);
 		z = y.divide(x);
-		assertEquals(z.type(),Type.INT8);
+		assertEquals(z.type(),Type.Int8);
 		assertEquals(z.asInt8(),0l);
 		
 		y = DatumFactory.createFloat4(3f);
 		z = x.divide(y);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 2.0f);
 		z = y.divide(x);
-		assertEquals(z.type(),Type.FLOAT4);
+		assertEquals(z.type(),Type.Float4);
 		assertTrue(z.asFloat4() == 0.5f);
 		
 		y = DatumFactory.createFloat8(3d);
 		z = x.divide(y);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 2.0d);
 		z = y.divide(x);
-		assertEquals(z.type(),Type.FLOAT8);
+		assertEquals(z.type(),Type.Float8);
 		assertTrue(z.asFloat8() == 0.5d);
 	}
 	
@@ -196,28 +196,28 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.equalsTo(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),false);		
 		z = y.equalsTo(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), false);
 		
 		x = DatumFactory.createFloat4(3.27f);
 		y = DatumFactory.createFloat4(3.27f);
 		z = x.equalsTo(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.equalsTo(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 		
 		x = DatumFactory.createInt8(123456789012345l);
 		y = DatumFactory.createInt8(123456789012345l);
 		z = x.equalsTo(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.equalsTo(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 	}
 	
@@ -230,10 +230,10 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.lessThan(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),false);		
 		z = y.lessThan(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 	}
 	
@@ -246,19 +246,19 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.lessThanEqual(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),false);		
 		z = y.lessThanEqual(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 		
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(6);
 		z = x.lessThanEqual(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.lessThanEqual(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 	}
 	
@@ -271,19 +271,19 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.greaterThan(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.greaterThan(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), false);
 		
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(6);
 		z = x.greaterThan(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),false);		
 		z = y.greaterThan(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), false);
 	}
 	
@@ -296,19 +296,19 @@ public class TestDatum {
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(3);
 		z = x.greaterThanEqual(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.greaterThanEqual(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), false);
 		
 		x = DatumFactory.createInt4(6);
 		y = DatumFactory.createInt4(6);
 		z = x.greaterThanEqual(y);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(),true);		
 		z = y.greaterThanEqual(x);
-		assertEquals(z.type(),Type.BOOLEAN);
+		assertEquals(z.type(),Type.Bool);
 		assertEquals(z.asBool(), true);
 	}
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestDatumFactory.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestDatumFactory.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestDatumFactory.java
index ffb3a30..2f96aa9 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestDatumFactory.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestDatumFactory.java
@@ -18,8 +18,8 @@
 
 package org.apache.tajo.datum;
 
+import org.apache.tajo.type.Type;
 import org.junit.Test;
-import org.apache.tajo.common.TajoDataTypes.Type;
 
 import static org.junit.Assert.assertEquals;
 
@@ -28,48 +28,48 @@ public class TestDatumFactory {
 	@Test
 	public final void testCreateBit() {
 		Datum d = DatumFactory.createBit((byte) 5);
-		assertEquals(Type.BIT, d.type());
+		assertEquals(Type.Bit, d.type());
 	}
 
 	@Test
 	public final void testCreateInt2() {
 		Datum d = DatumFactory.createInt2((short) 5);
-		assertEquals(Type.INT2, d.type());
+		assertEquals(Type.Int2, d.type());
 	}
 	
 	@Test
 	public final void testCreateInt4() {
 		Datum d = DatumFactory.createInt4(5);
-		assertEquals(Type.INT4, d.type());
+		assertEquals(Type.Int4, d.type());
 	}
 	
 	@Test
 	public final void testCreateInt8() {
 		Datum d = DatumFactory.createInt8((long) 5);
-		assertEquals(Type.INT8, d.type());
+		assertEquals(Type.Int8, d.type());
 	}
 
 	@Test
 	public final void testCreateFloat4() {
 		Datum d = DatumFactory.createFloat4(5.0f);
-		assertEquals(Type.FLOAT4, d.type());
+		assertEquals(Type.Float4, d.type());
 	}
 
 	@Test
 	public final void testCreateFloat8() {
 		Datum d = DatumFactory.createFloat8(5.0d);
-		assertEquals(Type.FLOAT8, d.type());
+		assertEquals(Type.Float8, d.type());
 	}
 
 	@Test
 	public final void testCreateBoolean() {
 		Datum d = DatumFactory.createBool(true);
-		assertEquals(Type.BOOLEAN, d.type());
+		assertEquals(Type.Bool, d.type());
 	}
 
 	@Test
 	public final void testCreateString() {
 		Datum d = DatumFactory.createText("12345a");
-		assertEquals(Type.TEXT, d.type());
+		assertEquals(Type.Text, d.type());
 	}
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestFloat8Datum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestFloat8Datum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestFloat8Datum.java
index b2b49f2..1d4ffb8 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestFloat8Datum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestFloat8Datum.java
@@ -28,12 +28,6 @@ import static org.junit.Assert.assertTrue;
 public class TestFloat8Datum {
 
 	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createFloat8(1d);
-		assertEquals(Type.FLOAT8, d.type());
-	}
-
-	@Test
 	public final void testAsInt4() {
 		Datum d = DatumFactory.createFloat8(5d);
 		assertEquals(5,d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestFloatDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestFloatDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestFloatDatum.java
index cd92dda..417de83 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestFloatDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestFloatDatum.java
@@ -28,12 +28,6 @@ import static org.junit.Assert.assertTrue;
 public class TestFloatDatum {
 
 	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createFloat4(1f);
-		assertEquals(Type.FLOAT4, d.type());
-	}
-
-	@Test
 	public final void testAsInt() {
 		Datum d = DatumFactory.createFloat4(5f);
 		assertEquals(5,d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestInt2Datum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt2Datum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt2Datum.java
index 6af9700..e92f0d2 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt2Datum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt2Datum.java
@@ -18,7 +18,6 @@
 
 package org.apache.tajo.datum;
 
-import org.apache.tajo.common.TajoDataTypes.Type;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -26,12 +25,6 @@ import static org.junit.Assert.*;
 public class TestInt2Datum {
 
 	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createInt2((short) 1);
-		assertEquals(d.type(), Type.INT2);
-	}
-
-	@Test
 	public final void testAsInt4() {
 		Datum d = DatumFactory.createInt2((short) 5);
 		assertEquals(5,d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestInt4Datum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt4Datum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt4Datum.java
index 294f8bb..ca8daa7 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt4Datum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt4Datum.java
@@ -18,7 +18,6 @@
 
 package org.apache.tajo.datum;
 
-import org.apache.tajo.common.TajoDataTypes;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -26,12 +25,6 @@ import static org.junit.Assert.*;
 public class TestInt4Datum {
 
   @Test
-  public final void testType() {
-    Datum d = DatumFactory.createInt4(1);
-    assertEquals(TajoDataTypes.Type.INT4, d.type());
-  }
-
-  @Test
   public final void testAsInt() {
     Datum d = DatumFactory.createInt4(5);
     assertEquals(5, d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestInt8Datum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt8Datum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt8Datum.java
index 7c07114..e625556 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestInt8Datum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestInt8Datum.java
@@ -19,21 +19,12 @@
 package org.apache.tajo.datum;
 
 import org.junit.Test;
-import org.apache.tajo.common.TajoDataTypes.Type;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class TestInt8Datum {
 
 	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createInt8(1l);
-		assertEquals(d.type(), Type.INT8);
-	}
-
-	@Test
 	public final void testAsInt() {
 		Datum d = DatumFactory.createInt8(5l);
 		assertEquals(5,d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
index b319c9c..5f7e074 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestIntervalDatum.java
@@ -20,6 +20,7 @@ package org.apache.tajo.datum;
 
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.exception.InvalidOperationException;
+import org.apache.tajo.type.Type;
 import org.apache.tajo.util.datetime.DateTimeUtil;
 import org.junit.Test;
 
@@ -68,7 +69,7 @@ public class TestIntervalDatum {
 
     for (int i = 0; i < datums.length; i++) {
       Datum result = datum.plus(datums[i]);
-      assertEquals(TajoDataTypes.Type.DATE, result.type());
+      assertEquals(Type.Date, result.type());
       assertEquals("date '2001-09-28' + " + datums[i].asChars() + "(" + i + " th test)", "2001-10-05", result.asChars());
     }
 
@@ -76,38 +77,38 @@ public class TestIntervalDatum {
     // date '2001-09-28' + interval '1 hour'	==> timestamp '2001-09-28 01:00:00'
     datum = DatumFactory.createDate(2001, 9, 28);
     Datum result = datum.plus(new IntervalDatum(60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-28 01:00:00", null), result);
 
     // interval '1 hour' +  date '2001-09-28'	==> timestamp '2001-09-28 01:00:00'
     datum = new IntervalDatum(60 * 60 * 1000);
     result = datum.plus(DatumFactory.createDate(2001, 9, 28));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-28 01:00:00", null), result);
 
     // date '2001-09-28' + time '03:00' ==> timestamp '2001-09-28 03:00:00'
     datum = DatumFactory.createDate(2001, 9, 28);
     TimeDatum time = new TimeDatum(DateTimeUtil.toTime(3, 0, 0, 0));
     result = datum.plus(time);
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-28 03:00:00", null), result);
 
     // interval '1 day' + interval '1 hour'	interval '1 day 01:00:00'
     datum = new IntervalDatum(IntervalDatum.DAY_MILLIS);
     result = datum.plus(new IntervalDatum(0, 1 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals("1 day 01:00:00", result.asChars());
 
     // timestamp '2001-09-28 01:00' + interval '23 hours'	==> timestamp '2001-09-29 00:00:00'
     datum = new TimestampDatum(DateTimeUtil.toJulianTimestamp(2001, 9, 28, 1, 0, 0, 0));
     result = datum.plus(new IntervalDatum(23 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-29 00:00:00", null), result);
 
     // time '01:00' + interval '3 hours' ==> time '04:00:00'
     datum = new TimeDatum(DateTimeUtil.toTime(1, 0, 0, 0));
     result = datum.plus(new IntervalDatum(3 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIME, result.type());
+    assertEquals(Type.Time, result.type());
     assertEquals(new TimeDatum(DateTimeUtil.toTime(4, 0, 0, 0)), result);
 
     // - interval '23 hours' ==> interval '-23:00:00'
@@ -116,59 +117,59 @@ public class TestIntervalDatum {
     // date '2001-10-01' - date '2001-09-28' ==>	integer '3'
     datum = DatumFactory.createDate(2001, 10, 1);
     result = datum.minus(DatumFactory.createDate(2001, 9, 28));
-    assertEquals(TajoDataTypes.Type.INT4, result.type());
+    assertEquals(Type.Int4, result.type());
     assertEquals(new Int4Datum(3), result);
 
     // date '2001-10-01' - integer '7' ==>	date '2001-09-24'
     datum = DatumFactory.createDate(2001, 10, 1);
     for (Datum eachDatum : datums) {
       Datum result2 = datum.minus(eachDatum);
-      assertEquals(TajoDataTypes.Type.DATE, result2.type());
+      assertEquals(Type.Date, result2.type());
       assertEquals(DatumFactory.createDate(2001, 9, 24), result2);
     }
 
     // date '2001-09-28' - interval '1 hour' ==> timestamp '2001-09-27 23:00:00'
     datum = DatumFactory.createDate(2001, 9, 28);
     result = datum.minus(new IntervalDatum(1 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-27 23:00:00", null), result);
 
     // date '2001-09-28' - interval '1 day 1 hour' ==> timestamp '2001-09-26 23:00:00'
     // In this case all datums are UTC
     datum = DatumFactory.createDate(2001, 9, 28);
     result = datum.minus(new IntervalDatum(IntervalDatum.DAY_MILLIS + 1 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-26 23:00:00", null),  result);
 
     // time '05:00' - time '03:00' ==>	interval '02:00:00'
     datum = new TimeDatum(DateTimeUtil.toTime(5, 0, 0, 0));
     result = datum.minus(new TimeDatum(DateTimeUtil.toTime(3, 0, 0, 0)));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals(new IntervalDatum(2 * 60 * 60 * 1000), result);
 
     // time '05:00' - interval '2 hours' ==>	time '03:00:00'
     datum = new TimeDatum(DateTimeUtil.toTime(5, 0, 0, 0));
     result = datum.minus(new IntervalDatum(2 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIME, result.type());
+    assertEquals(Type.Time, result.type());
     assertEquals(new TimeDatum(DateTimeUtil.toTime(3, 0, 0, 0)), result);
 
     // timestamp '2001-09-28 23:00' - interval '23 hours' ==>	timestamp '2001-09-28 00:00:00'
     // In this case all datums are UTC
     datum = new TimestampDatum(DateTimeUtil.toJulianTimestamp(2001, 9, 28, 23, 0, 0, 0));
     result = datum.minus(new IntervalDatum(23 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-28 00:00:00", null), result);
 
     // interval '1 day' - interval '1 hour'	==> interval '1 day -01:00:00'
     datum = new IntervalDatum(IntervalDatum.DAY_MILLIS);
     result = datum.minus(new IntervalDatum(1 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals(new IntervalDatum(23 * 60 * 60 * 1000), result);
 
     // timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00' ==>	interval '1 day 15:00:00'
     datum = new TimestampDatum(DateTimeUtil.toJulianTimestamp(2001, 9, 29, 3, 0, 0, 0));
     result = datum.minus(new TimestampDatum(DateTimeUtil.toJulianTimestamp(2001, 9, 27, 12, 0, 0, 0)));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals(new IntervalDatum(IntervalDatum.DAY_MILLIS + 15 * 60 * 60 * 1000), result);
 
     // 900 * interval '1 second' ==> interval '00:15:00'
@@ -178,31 +179,31 @@ public class TestIntervalDatum {
     datum = new IntervalDatum(1000);
     for (Datum aDatum900 : datum900) {
       Datum result2 = datum.multiply(aDatum900);
-      assertEquals(TajoDataTypes.Type.INTERVAL, result2.type());
+      assertEquals(Type.Interval, result2.type());
       assertEquals(new IntervalDatum(15 * 60 * 1000), result2);
 
       result2 = aDatum900.multiply(datum);
-      assertEquals(TajoDataTypes.Type.INTERVAL, result2.type());
+      assertEquals(Type.Interval, result2.type());
       assertEquals(new IntervalDatum(15 * 60 * 1000), result2);
     }
 
     // double precision '3.5' * interval '1 hour'	==> interval '03:30:00'
     datum = new Float8Datum(3.5f);
     result = datum.multiply(new IntervalDatum(1 * 60 * 60 * 1000));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals(new IntervalDatum(3 * 60 * 60 * 1000 + 30 * 60 * 1000), result);
 
     // interval '1 hour' / double precision '1.5' ==>	interval '00:40:00'
     datum = new IntervalDatum(1 * 60 * 60 * 1000);
     result = datum.divide(new Float8Datum(1.5f));
-    assertEquals(TajoDataTypes.Type.INTERVAL, result.type());
+    assertEquals(Type.Interval, result.type());
     assertEquals(new IntervalDatum(40 * 60 * 1000), result);
 
     // timestamp '2001-08-31 01:00:00' + interval '1 mons' ==> timestamp 2001-09-30 01:00:00
     // In this case all datums are UTC
     datum = new TimestampDatum(DateTimeUtil.toJulianTimestamp(2001, 8, 31, 1, 0, 0, 0));
     result = datum.plus(new IntervalDatum(1, 0));
-    assertEquals(TajoDataTypes.Type.TIMESTAMP, result.type());
+    assertEquals(Type.Timestamp, result.type());
     assertEquals(DatumFactory.parseTimestamp("2001-09-30 01:00:00", null), result);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestTextDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestTextDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestTextDatum.java
index 2624d33..d7e569b 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestTextDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestTextDatum.java
@@ -18,7 +18,7 @@
 
 package org.apache.tajo.datum;
 
-import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.type.Type;
 import org.junit.Test;
 import org.powermock.reflect.Whitebox;
 
@@ -29,12 +29,6 @@ import static org.junit.Assert.*;
 public class TestTextDatum {
 
 	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createText("12345");
-		assertEquals(d.type(), Type.TEXT);
-	}
-
-	@Test
 	public final void testAsInt4() {
 		Datum d = DatumFactory.createText("12345");
 		assertEquals(12345,d.asInt4());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestTimeDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimeDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimeDatum.java
index 7058b52..ae5a9ac 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimeDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimeDatum.java
@@ -18,8 +18,8 @@
 
 package org.apache.tajo.datum;
 
+import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.DataType;
-import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.json.CommonGsonHelper;
 import org.junit.Test;
@@ -30,12 +30,6 @@ import static org.junit.Assert.assertEquals;
 public class TestTimeDatum {
   private static String TIME = "12:34:56";
 
-  @Test
-  public final void testType() {
-    Datum d = DatumFactory.createTime(TIME);
-    assertEquals(Type.TIME, d.type());
-  }
-
   @Test(expected = TajoRuntimeException.class)
   public final void testAsInt4() {
     Datum d = DatumFactory.createTime(TIME);
@@ -106,7 +100,7 @@ public class TestTimeDatum {
   @Test
   public final void testTimeDatumFromCreateFromInt8() {
     TimeDatum d = DatumFactory.createTime(TIME);
-    DataType type = DataType.newBuilder().setType(Type.TIME).build();
+    DataType type = DataType.newBuilder().setType(TajoDataTypes.Type.TIME).build();
     TimeDatum copy = (TimeDatum)DatumFactory.createFromInt8(type, d.asInt8());
 
     assertEquals(d, copy);

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
index 2bbb92d..32d4784 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
@@ -18,7 +18,6 @@
 
 package org.apache.tajo.datum;
 
-import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.InvalidOperationException;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.json.CommonGsonHelper;
@@ -45,12 +44,6 @@ public class TestTimestampDatum {
     unixtime = (int) (javatime / 1000);
   }
 
-	@Test
-	public final void testType() {
-		Datum d = DatumFactory.createTimestampDatumWithUnixTime(unixtime);
-    assertEquals(Type.TIMESTAMP, d.type());
-	}
-
 	@Test(expected = TajoRuntimeException.class)
 	public final void testAsInt4() {
     Datum d = DatumFactory.createTimestampDatumWithUnixTime(unixtime);

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java
index 6a9be2e..b93b964 100644
--- a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java
+++ b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java
@@ -288,7 +288,7 @@ public class TestMemoryRowBlock {
     int count = 0;
     for (VTuple aRowBlock : rowBlock) {
       for (int m = 0; m < schema.length; m++) {
-        if (aRowBlock.contains(m) && aRowBlock.get(m).type() == Type.INT4) {
+        if (aRowBlock.contains(m) && aRowBlock.get(m).kind() == Type.INT4) {
           count++;
         }
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonArrayContains.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonArrayContains.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonArrayContains.java
index c0287a9..9f90e4c 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonArrayContains.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/function/json/JsonArrayContains.java
@@ -66,13 +66,13 @@ public class JsonArrayContains extends ScalarJsonFunction {
 
         if (isFirst) {
           isFirst = false;
-          if (actualParam.type() == TajoDataTypes.Type.INT1 ||
-              actualParam.type() == TajoDataTypes.Type.INT2 ||
-              actualParam.type() == TajoDataTypes.Type.INT4 ||
-              actualParam.type() == TajoDataTypes.Type.INT8) {
+          if (actualParam.kind() == TajoDataTypes.Type.INT1 ||
+              actualParam.kind() == TajoDataTypes.Type.INT2 ||
+              actualParam.kind() == TajoDataTypes.Type.INT4 ||
+              actualParam.kind() == TajoDataTypes.Type.INT8) {
             isLong = true;
-          } else if (actualParam.type() == TajoDataTypes.Type.FLOAT4 ||
-              actualParam.type() == TajoDataTypes.Type.FLOAT8) {
+          } else if (actualParam.kind() == TajoDataTypes.Type.FLOAT4 ||
+              actualParam.kind() == TajoDataTypes.Type.FLOAT8) {
             isDouble = true;
           }
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
index aaf64cd..b646658 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
@@ -2132,7 +2132,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
       } else if (dataType.hasLengthOrPrecision()) {
         return Numeric(dataType.getLengthOrPrecision());
       } else {
-        return Numeric();
+        return Numeric;
       }
     } else {
       return TypeFactory.create(type);

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java
index b565b80..a565d02 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java
@@ -21,7 +21,6 @@ package org.apache.tajo.plan.expr;
 import com.google.common.base.Objects;
 import com.google.gson.annotations.Expose;
 import org.apache.tajo.DataTypeUtil;
-import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.datum.NullDatum;
@@ -154,7 +153,7 @@ public class BinaryEval extends EvalNode implements Cloneable {
       return lhs.modular(rhs);
 
     case CONCATENATE:
-      if (lhs.type() == TajoDataTypes.Type.NULL_TYPE || rhs.type() == TajoDataTypes.Type.NULL_TYPE) {
+      if (lhs.type().isNull() || rhs.type().isNull()) {
         return NullDatum.get();
       }
       return DatumFactory.createText(lhs.asChars() + rhs.asChars());

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/expr/ConstEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/ConstEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/ConstEval.java
index 4f1ece6..b60f06a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/ConstEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/ConstEval.java
@@ -23,7 +23,6 @@ import com.google.gson.annotations.Expose;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.storage.Tuple;
 import org.apache.tajo.type.Type;
-import org.apache.tajo.type.TypeFactory;
 
 public class ConstEval extends EvalNode implements Comparable<ConstEval>, Cloneable {
 	@Expose Datum datum = null;
@@ -51,7 +50,7 @@ public class ConstEval extends EvalNode implements Comparable<ConstEval>, Clonea
 
   @Override
 	public Type getValueType() {
-    return TypeFactory.create(datum.type());
+    return datum.type();
 	}
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
index 21d3517..6e86890 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/RowConstantEval.java
@@ -23,7 +23,6 @@ import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.NullDatum;
 import org.apache.tajo.storage.Tuple;
 import org.apache.tajo.type.Type;
-import org.apache.tajo.type.TypeFactory;
 import org.apache.tajo.util.StringUtils;
 import org.apache.tajo.util.TUtil;
 
@@ -39,7 +38,7 @@ public class RowConstantEval extends ValueSetEval {
 
   @Override
   public Type getValueType() {
-    return TypeFactory.create(values[0].type());
+    return values[0].type();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
index 9371b36..83ea416 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
@@ -20,7 +20,6 @@ package org.apache.tajo.plan.function.stream;
 
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableMeta;
-import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.AnyDatum;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.exception.TajoRuntimeException;
@@ -59,7 +58,7 @@ public class CSVLineSerializer extends TextLineSerializer {
     for (int i = 0; i < input.size(); i++) {
       Datum datum = input.asDatum(i);
       String typeStr;
-      if (datum.type() == TajoDataTypes.Type.ANY) {
+      if (datum.type().isAny()) {
         typeStr = getTypeString(((AnyDatum)datum).getActual());
       } else {
         typeStr = getTypeString(datum);
@@ -78,19 +77,6 @@ public class CSVLineSerializer extends TextLineSerializer {
     return writtenBytes;
   }
 
-  private int serializeDatum(OutputStream out, Datum datum, TajoDataTypes.DataType dataType) throws IOException {
-    String typeStr;
-    if (datum.type() == TajoDataTypes.Type.ANY) {
-      typeStr = getTypeString(((AnyDatum)datum).getActual());
-    } else {
-      typeStr = getTypeString(datum);
-    }
-    out.write(typeStr.getBytes());
-    out.write(PARAM_DELIM.getBytes());
-
-    return serde.serialize(out, datum, dataType, nullChars);
-  }
-
   @Override
   public int serializeContext(OutputStream out, FunctionContext context) throws IOException {
     int writtenBytes = 0;
@@ -114,7 +100,7 @@ public class CSVLineSerializer extends TextLineSerializer {
   }
 
   public static String getTypeString(Datum val) {
-    switch (val.type()) {
+    switch (val.kind()) {
       case NULL_TYPE:
         return "-";
       case BOOLEAN:
@@ -141,7 +127,7 @@ public class CSVLineSerializer extends TextLineSerializer {
       case BLOB:
         return "A";
       default:
-        throw new TajoRuntimeException(new UnsupportedException("data type '" + val.type().name() + "'"));
+        throw new TajoRuntimeException(new UnsupportedException("data type '" + val.type() + "'"));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
index 7bcb694..84b1dbe 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
@@ -137,7 +137,7 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
         break;
       case ANY:
         AnyDatum anyDatum = (AnyDatum) datum;
-        length = serialize(out, anyDatum.getActual(), CatalogUtil.newSimpleDataType(anyDatum.getActual().type()),
+        length = serialize(out, anyDatum.getActual(), CatalogUtil.newSimpleDataType(anyDatum.getActual().kind()),
             nullChars);
         break;
       default:

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
index ecaa882..f791198 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
@@ -364,9 +364,9 @@ public class EvalNodeSerializer
   public static PlanProto.Datum serialize(Datum datum) {
     PlanProto.Datum.Builder builder = PlanProto.Datum.newBuilder();
 
-    builder.setType(datum.type());
+    builder.setType(datum.kind());
 
-    switch (datum.type()) {
+    switch (datum.kind()) {
     case NULL_TYPE:
       break;
     case BOOLEAN:
@@ -409,7 +409,7 @@ public class EvalNodeSerializer
       builder.setActual(serialize(((AnyDatum)datum).getActual()));
       break;
     default:
-      throw new RuntimeException("Unknown data type: " + datum.type().name());
+      throw new RuntimeException("Unknown data type: " + datum.type());
     }
 
     return builder.build();

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java
index 2ad6b6f..d3a51c1 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java
@@ -154,7 +154,7 @@ public class EvalNodeToExprConverter extends SimpleEvalNodeVisitor<Object> {
     Expr[] values = new Expr[evalNode.getValues().length];
     for (int i = 0; i < evalNode.getValues().length; i++) {
       Datum datum = evalNode.getValues()[i];
-      values[i] = convertDatumToExpr(datum.type(), datum);
+      values[i] = convertDatumToExpr(datum.kind(), datum);
     }
     ValueListExpr expr = new ValueListExpr(values);
     exprs.push(expr);

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-plan/src/main/java/org/apache/tajo/plan/util/WritableTypeConverter.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/WritableTypeConverter.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/WritableTypeConverter.java
index d83524c..04058e5 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/WritableTypeConverter.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/WritableTypeConverter.java
@@ -23,12 +23,13 @@ import org.apache.hadoop.hive.serde2.io.DateWritable;
 import org.apache.hadoop.hive.serde2.io.HiveCharWritable;
 import org.apache.hadoop.hive.serde2.io.TimestampWritable;
 import org.apache.hadoop.io.*;
-import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.common.TajoDataTypes.DataType;
+import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.datum.*;
 import org.apache.tajo.exception.NotImplementedException;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedDataTypeException;
+import org.apache.tajo.type.TypeStringEncoder;
 import org.apache.tajo.util.datetime.DateTimeConstants;
 import org.apache.tajo.util.datetime.DateTimeUtil;
 import org.reflections.ReflectionUtils;
@@ -83,7 +84,7 @@ public class WritableTypeConverter {
   }
 
   public static Writable convertDatum2Writable(Datum value) {
-    switch(value.type()) {
+    switch(value.kind()) {
       case INT1: return new ByteWritable(value.asByte());
       case INT2: return new ShortWritable(value.asInt2());
       case INT4: return new IntWritable(value.asInt4());
@@ -111,7 +112,7 @@ public class WritableTypeConverter {
       case NULL_TYPE: return null;
     }
 
-    throw new TajoRuntimeException(new NotImplementedException(value.type().name()));
+    throw new TajoRuntimeException(new NotImplementedException(TypeStringEncoder.encode(value.type())));
   }
 
   public static Datum convertWritable2Datum(Writable value) throws UnsupportedDataTypeException {

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/LazyTuple.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/LazyTuple.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/LazyTuple.java
index 72ffde7..903ca39 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/LazyTuple.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/LazyTuple.java
@@ -116,7 +116,7 @@ public class LazyTuple implements Tuple, Cloneable {
 
   @Override
   public TajoDataTypes.Type type(int fieldId) {
-    return get(fieldId).type();
+    return get(fieldId).kind();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MemoryUtil.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MemoryUtil.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MemoryUtil.java
deleted file mode 100644
index 16477cd..0000000
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MemoryUtil.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage;
-
-import org.apache.tajo.datum.*;
-import org.apache.tajo.util.ClassSize;
-
-public class MemoryUtil {
-
-  /** Overhead for an NullDatum */
-  public static final long NULL_DATUM;
-
-  /** Overhead for an BoolDatum */
-  public static final long BOOL_DATUM;
-
-  /** Overhead for an CharDatum */
-  public static final long CHAR_DATUM;
-
-  /** Overhead for an BitDatum */
-  public static final long BIT_DATUM;
-
-  /** Overhead for an Int2Datum */
-  public static final long INT2_DATUM;
-
-  /** Overhead for an Int4Datum */
-  public static final long INT4_DATUM;
-
-  /** Overhead for an Int8Datum */
-  public static final long INT8_DATUM;
-
-  /** Overhead for an Float4Datum */
-  public static final long FLOAT4_DATUM;
-
-  /** Overhead for an Float8Datum */
-  public static final long FLOAT8_DATUM;
-
-  /** Overhead for an TextDatum */
-  public static final long TEXT_DATUM;
-
-  /** Overhead for an BlobDatum */
-  public static final long BLOB_DATUM;
-
-  /** Overhead for an DateDatum */
-  public static final long DATE_DATUM;
-
-  /** Overhead for an TimeDatum */
-  public static final long TIME_DATUM;
-
-  /** Overhead for an TimestampDatum */
-  public static final long TIMESTAMP_DATUM;
-
-  static {
-    NULL_DATUM = ClassSize.estimateBase(NullDatum.class, false);
-
-    CHAR_DATUM = ClassSize.estimateBase(CharDatum.class, false);
-
-    BOOL_DATUM = ClassSize.estimateBase(BooleanDatum.class, false);
-
-    BIT_DATUM = ClassSize.estimateBase(BitDatum.class, false);
-
-    INT2_DATUM = ClassSize.estimateBase(Int2Datum.class, false);
-
-    INT4_DATUM = ClassSize.estimateBase(Int4Datum.class, false);
-
-    INT8_DATUM = ClassSize.estimateBase(Int8Datum.class, false);
-
-    FLOAT4_DATUM = ClassSize.estimateBase(Float4Datum.class, false);
-
-    FLOAT8_DATUM = ClassSize.estimateBase(Float8Datum.class, false);
-
-    TEXT_DATUM = ClassSize.estimateBase(TextDatum.class, false);
-
-    BLOB_DATUM = ClassSize.estimateBase(BlobDatum.class, false);
-
-    DATE_DATUM = ClassSize.estimateBase(DateDatum.class, false);
-
-    TIME_DATUM = ClassSize.estimateBase(TimeDatum.class, false);
-
-    TIMESTAMP_DATUM = ClassSize.estimateBase(TimestampDatum.class, false);
-  }
-
-  public static long calculateMemorySize(Tuple tuple) {
-    long total = ClassSize.OBJECT;
-    for (Datum datum : tuple.getValues()) {
-      switch (datum.type()) {
-
-      case NULL_TYPE:
-        total += NULL_DATUM;
-        break;
-
-      case BOOLEAN:
-        total += BOOL_DATUM;
-        break;
-
-      case BIT:
-        total += BIT_DATUM;
-        break;
-
-      case CHAR:
-        total += CHAR_DATUM + datum.size();
-        break;
-
-      case INT1:
-      case INT2:
-        total += INT2_DATUM;
-        break;
-
-      case INT4:
-        total += INT4_DATUM;
-        break;
-
-      case INT8:
-        total += INT8_DATUM;
-        break;
-
-      case FLOAT4:
-        total += FLOAT4_DATUM;
-        break;
-
-      case FLOAT8:
-        total += FLOAT4_DATUM;
-        break;
-
-      case TEXT:
-        total += TEXT_DATUM + datum.size();
-        break;
-
-      case BLOB:
-        total += BLOB_DATUM + datum.size();
-        break;
-
-      case DATE:
-        total += DATE_DATUM;
-        break;
-
-      case TIME:
-        total += TIME_DATUM;
-        break;
-
-      case TIMESTAMP:
-        total += TIMESTAMP_DATUM;
-        break;
-
-      default:
-        break;
-      }
-    }
-
-    return total;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/13212495/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
index da97e32..064d6cb 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
@@ -229,7 +229,7 @@ public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionG
    * @param d Datum
    */
   public String convertDatumToSQLLiteral(Datum d) {
-    switch (d.type()) {
+    switch (d.kind()) {
     case BOOLEAN:
       return d.asBool() ? "TRUE" : "FALSE";
 
@@ -260,7 +260,7 @@ public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionG
       return "NULL";
 
     default:
-      throw new TajoRuntimeException(new UnsupportedDataTypeException(d.type().name()));
+      throw new TajoRuntimeException(new UnsupportedDataTypeException(d.type().toString()));
     }
   }
 


Mime
View raw message