tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [03/13] tajo git commit: TAJO-1450: Encapsulate Datum in Tuple.
Date Mon, 15 Jun 2015 22:42:25 GMT
http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
index 05b0418..d177c48 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
@@ -214,7 +214,7 @@ public class WindowAggExec extends UnaryPhysicalExec {
         if (readTuple != null && hasPartitionKeys) { // get a key tuple
           currentKey = new VTuple(partitionKeyIds.length);
           for (int i = 0; i < partitionKeyIds.length; i++) {
-            currentKey.put(i, readTuple.get(partitionKeyIds[i]));
+            currentKey.put(i, readTuple.asDatum(partitionKeyIds[i]));
           }
         }
       }
@@ -273,7 +273,7 @@ public class WindowAggExec extends UnaryPhysicalExec {
   private void preAccumulatingNextWindow(Tuple inTuple) {
     Tuple projectedTuple = new VTuple(outSchema.size());
     for(int idx = 0; idx < nonFunctionColumnNum; idx++) {
-      projectedTuple.put(idx, inTuple.get(nonFunctionColumns[idx]));
+      projectedTuple.put(idx, inTuple.asDatum(nonFunctionColumns[idx]));
     }
     nextAccumulatedProjected = Lists.newArrayList();
     nextAccumulatedProjected.add(projectedTuple);
@@ -291,10 +291,10 @@ public class WindowAggExec extends UnaryPhysicalExec {
 
       Tuple projectedTuple = new VTuple(schemaForOrderBy.size());
       for (int c = 0; c < nonFunctionColumnNum; c++) {
-        projectedTuple.put(c, inTuple.get(nonFunctionColumns[c]));
+        projectedTuple.put(c, inTuple.asDatum(nonFunctionColumns[c]));
       }
       for (int c = 0; c < sortKeyColumns.length; c++) {
-        projectedTuple.put(outputColumnNum + c, inTuple.get(sortKeyColumns[c]));
+        projectedTuple.put(outputColumnNum + c, inTuple.asDatum(sortKeyColumns[c]));
       }
 
       evaluatedTuples.add(projectedTuple);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/engine/utils/TupleUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/utils/TupleUtil.java b/tajo-core/src/main/java/org/apache/tajo/engine/utils/TupleUtil.java
index c01900a..1dcbcab 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/utils/TupleUtil.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/utils/TupleUtil.java
@@ -126,8 +126,8 @@ public class TupleUtil {
           "ERROR: Invalid Column Stats (column stats: " + colStats + ", there exists not target " + col);
     }
 
-    Tuple startTuple = new VTuple(target.size());
-    Tuple endTuple = new VTuple(target.size());
+    VTuple startTuple = new VTuple(target.size());
+    VTuple endTuple = new VTuple(target.size());
     int i = 0;
     int sortSpecIndex = 0;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
index 562dbc3..bc0d212 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultSystemScanner.java
@@ -23,7 +23,6 @@ import com.google.protobuf.ByteString;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.QueryId;
-import org.apache.tajo.SessionVars;
 import org.apache.tajo.TaskAttemptId;
 import org.apache.tajo.TaskId;
 import org.apache.tajo.catalog.*;
@@ -52,7 +51,6 @@ import org.apache.tajo.plan.logical.IndexScanNode;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.ScanNode;
 import org.apache.tajo.session.InvalidSessionException;
-import org.apache.tajo.session.Session;
 import org.apache.tajo.storage.RowStoreUtil;
 import org.apache.tajo.storage.RowStoreUtil.RowStoreEncoder;
 import org.apache.tajo.storage.Tuple;
@@ -62,7 +60,10 @@ import org.apache.tajo.util.TUtil;
 import org.apache.tajo.worker.TaskAttemptContext;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
 
 public class NonForwardQueryResultSystemScanner implements NonForwardQueryResultScanner {
   
@@ -149,7 +150,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(tablespaces.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (TablespaceProto tablespace: tablespaces) {
       aTuple = new VTuple(outSchema.size());
       
@@ -184,7 +185,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(databases.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (DatabaseProto database: databases) {
       aTuple = new VTuple(outSchema.size());
       
@@ -214,7 +215,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(tables.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (TableDescriptorProto table: tables) {
       aTuple = new VTuple(outSchema.size());
       
@@ -298,7 +299,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(indexList.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (IndexProto index: indexList) {
       aTuple = new VTuple(outSchema.size());
       
@@ -337,7 +338,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(optionList.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (TableOptionProto option: optionList) {
       aTuple = new VTuple(outSchema.size());
       
@@ -364,7 +365,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(statList.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (TableStatsProto stat: statList) {
       aTuple = new VTuple(outSchema.size());
       
@@ -391,7 +392,7 @@ public class NonForwardQueryResultSystemScanner implements NonForwardQueryResult
     List<Tuple> tuples = new ArrayList<Tuple>(partitionList.size());
     List<Column> columns = outSchema.getRootColumns();
     Tuple aTuple;
-    
+
     for (TablePartitionProto partition: partitionList) {
       aTuple = new VTuple(outSchema.size());
       

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
index 22b8c4c..281edad 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
@@ -277,7 +277,7 @@ public class QueryExecutor {
     try {
       // start script executor
       startScriptExecutors(queryContext, evalContext, targets);
-      final Tuple outTuple = new VTuple(targets.length);
+      final VTuple outTuple = new VTuple(targets.length);
       for (int i = 0; i < targets.length; i++) {
         EvalNode eval = targets[i].getEvalTree();
         eval.bind(evalContext, null);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java b/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
index af86abc..66aedc0 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java
@@ -301,14 +301,13 @@ public class ExprTestBase {
       }
 
       for (int i = 0; i < expected.length; i++) {
-        Datum datum = outTuple.get(i);
         String outTupleAsChars;
-        if (datum.type() == Type.TIMESTAMP) {
-          outTupleAsChars = ((TimestampDatum) datum).asChars(timeZone, false);
-        } else if (datum.type() == Type.TIME) {
-          outTupleAsChars = ((TimeDatum) datum).asChars(timeZone, false);
+        if (outTuple.type(i) == Type.TIMESTAMP) {
+          outTupleAsChars = TimestampDatum.asChars(outTuple.getTimeDate(i), timeZone, false);
+        } else if (outTuple.type(i) == Type.TIME) {
+          outTupleAsChars = TimeDatum.asChars(outTuple.getTimeDate(i), timeZone, false);
         } else {
-          outTupleAsChars = datum.asChars();
+          outTupleAsChars = outTuple.getText(i);
         }
         assertEquals(query, expected[i], outTupleAsChars);
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
index dd5a75a..4bfe640 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
@@ -81,8 +81,8 @@ public class TestEvalTreeUtil {
 
     @Override
     public Datum eval(Tuple params) {
-      x =  params.get(0).asInt4();
-      y =  params.get(1).asInt4();
+      x =  params.getInt4(0);
+      y =  params.getInt4(1);
       return DatumFactory.createInt4(x + y);
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
index 52982c0..b04d544 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
@@ -861,7 +861,7 @@ public class TestSQLExpression extends ExprTestBase {
     int unixtime = 1389071574; // (int) (System.currentTimeMillis() / 1000);
     TimestampDatum expected = DatumFactory.createTimestmpDatumWithUnixTime(unixtime);
     testSimpleEval(context, String.format("select to_timestamp(CAST(split_part('%d.999', '.', 1) as INT8));", unixtime),
-        new String[] {expected.asChars(tz, false)});
+        new String[] {TimestampDatum.asChars(expected.asTimeMeta(), tz, false)});
   }
 
   @Test
@@ -887,10 +887,11 @@ public class TestSQLExpression extends ExprTestBase {
 
     testEval(queryContext, schema, "table1", "1980-04-01 01:50:01,234",
         "select col1::timestamp as t1, col2::float from table1 where t1 = '1980-04-01 01:50:01'::timestamp",
-        new String[]{timestamp.asChars(tz, false), "234.0"}
+        new String[]{TimestampDatum.asChars(timestamp.asTimeMeta(), tz, false), "234.0"}
     );
 
-    testSimpleEval("select '1980-04-01 01:50:01'::timestamp;", new String[]{timestamp.asChars(tz, false)});
+    testSimpleEval("select '1980-04-01 01:50:01'::timestamp;", new String[]{
+        TimestampDatum.asChars(timestamp.asTimeMeta(), tz, false)});
     testSimpleEval("select '1980-04-01 01:50:01'::timestamp::text", new String[]{"1980-04-01 01:50:01"});
 
     testSimpleEval("select (cast ('99999'::int8 as text))::int4 + 1", new String[]{"100000"});

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java
index c5ef4ef..178af47 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java
@@ -43,8 +43,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt2((short) 1));
     e.put(0, DatumFactory.createInt2((short) 30000));
 
@@ -74,8 +74,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt2((short) 30000));
     e.put(0, DatumFactory.createInt2((short) 1));
 
@@ -104,8 +104,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt4(1));
     e.put(0, DatumFactory.createInt4(10000));
 
@@ -135,8 +135,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt4(10000));
     e.put(0, DatumFactory.createInt4(1));
 
@@ -165,8 +165,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt8(1));
     e.put(0, DatumFactory.createInt8(10000));
 
@@ -196,8 +196,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createInt8(10000));
     e.put(0, DatumFactory.createInt8(1));
 
@@ -226,8 +226,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createFloat4((float) 1.0));
     e.put(0, DatumFactory.createFloat4((float) 10000.0));
 
@@ -257,8 +257,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createFloat4((float) 10000.0));
     e.put(0, DatumFactory.createFloat4((float) 1.0));
 
@@ -287,8 +287,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createFloat8(1.0));
     e.put(0, DatumFactory.createFloat8(10000.0));
 
@@ -318,8 +318,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createFloat8((float) 10000.0));
     e.put(0, DatumFactory.createFloat8((float) 1.0));
 
@@ -352,10 +352,10 @@ public class TestUniformRangePartition {
 
     SortSpec[] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createText("A"));
     s.put(1, DatumFactory.createText("A"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createText("D"));
     e.put(1, DatumFactory.createText("C"));
 
@@ -379,12 +379,12 @@ public class TestUniformRangePartition {
     result[11] = "DC";
 
     Tuple end = partitioner.increment(s, BigInteger.valueOf(1), 1);
-    assertEquals("A", end.get(0).asChars());
-    assertEquals("B", end.get(1).asChars());
+    assertEquals("A", end.getText(0));
+    assertEquals("B", end.getText(1));
     for (int i = 2; i < 11; i++ ) {
       end = partitioner.increment(end, BigInteger.valueOf(1), 1);
-      assertEquals(result[i].charAt(0), end.get(0).asChars().charAt(0));
-      assertEquals(result[i].charAt(1), end.get(1).asChars().charAt(0));
+      assertEquals(result[i].charAt(0), end.getText(0).charAt(0));
+      assertEquals(result[i].charAt(1), end.getText(1).charAt(0));
     }
   }
 
@@ -399,10 +399,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createText("A"));
     s.put(1, DatumFactory.createText("A"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createText("D"));
     e.put(1, DatumFactory.createText("C"));
 
@@ -426,11 +426,11 @@ public class TestUniformRangePartition {
     result[11] = "DC";
 
     Tuple end = partitioner.increment(s, BigInteger.valueOf(6), 1);
-    assertEquals("C", end.get(0).asChars());
-    assertEquals("A", end.get(1).asChars());
+    assertEquals("C", end.getText(0));
+    assertEquals("A", end.getText(1));
     end = partitioner.increment(end, BigInteger.valueOf(5), 1);
-    assertEquals("D", end.get(0).asChars());
-    assertEquals("C", end.get(1).asChars());
+    assertEquals("D", end.getText(0));
+    assertEquals("C", end.getText(1));
   }
 
   /**
@@ -445,11 +445,11 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(3);
+    VTuple s = new VTuple(3);
     s.put(0, DatumFactory.createText("A"));
     s.put(1, DatumFactory.createText("A"));
     s.put(2, DatumFactory.createText("A"));
-    Tuple e = new VTuple(3);
+    VTuple e = new VTuple(3);
     e.put(0, DatumFactory.createText("D")); //  4
     e.put(1, DatumFactory.createText("B")); //  2
     e.put(2, DatumFactory.createText("C")); // x3 = 24
@@ -460,13 +460,13 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().intValue());
 
     Tuple overflowBefore = partitioner.increment(s, BigInteger.valueOf(5), 2);
-    assertEquals("A", overflowBefore.get(0).asChars());
-    assertEquals("B", overflowBefore.get(1).asChars());
-    assertEquals("C", overflowBefore.get(2).asChars());
+    assertEquals("A", overflowBefore.getText(0));
+    assertEquals("B", overflowBefore.getText(1));
+    assertEquals("C", overflowBefore.getText(2));
     Tuple overflowed = partitioner.increment(overflowBefore, BigInteger.valueOf(1), 2);
-    assertEquals("B", overflowed.get(0).asChars());
-    assertEquals("A", overflowed.get(1).asChars());
-    assertEquals("A", overflowed.get(2).asChars());
+    assertEquals("B", overflowed.getText(0));
+    assertEquals("A", overflowed.getText(1));
+    assertEquals("A", overflowed.getText(2));
   }
 
   @Test
@@ -476,9 +476,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("가가가"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("하하하"));
 
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -504,9 +504,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("가"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("다"));
 
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -534,9 +534,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("가"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("꽥"));
 
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -564,8 +564,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("가가가"));
     e.put(0, DatumFactory.createText("하하하"));
 
@@ -594,8 +594,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("가"));
     e.put(0, DatumFactory.createText("하하하"));
 
@@ -624,8 +624,8 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("가가가"));
     e.put(0, DatumFactory.createText("하"));
 
@@ -655,8 +655,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("하하하"));
     e.put(0, DatumFactory.createText("가가가"));
 
@@ -686,8 +686,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("하"));
     e.put(0, DatumFactory.createText("가가가"));
 
@@ -717,8 +717,8 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
-    Tuple e = new VTuple(1);
+    VTuple s = new VTuple(1);
+    VTuple e = new VTuple(1);
     s.put(0, DatumFactory.createText("하"));
     e.put(0, DatumFactory.createText("가가가"));
 
@@ -748,10 +748,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createInt8(10));
     s.put(1, DatumFactory.createInt8(20));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createInt8(19));
     e.put(1, DatumFactory.createInt8(39));
 
@@ -761,11 +761,11 @@ public class TestUniformRangePartition {
     assertEquals(200, partitioner.getTotalCardinality().longValue());
 
     Tuple range2 = partitioner.increment(s, BigInteger.valueOf(100), 1);
-    assertEquals(15, range2.get(0).asInt4());
-    assertEquals(20, range2.get(1).asInt4());
+    assertEquals(15, range2.getInt4(0));
+    assertEquals(20, range2.getInt4(1));
     Tuple range3 = partitioner.increment(range2, BigInteger.valueOf(99), 1);
-    assertEquals(19, range3.get(0).asInt4());
-    assertEquals(39, range3.get(1).asInt4());
+    assertEquals(19, range3.getInt4(0));
+    assertEquals(39, range3.getInt4(1));
   }
 
   @Test public void testIncrementOfInt8AndFinal() {
@@ -776,11 +776,11 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(3);
+    VTuple s = new VTuple(3);
     s.put(0, DatumFactory.createInt8(1));
     s.put(1, DatumFactory.createInt8(1));
     s.put(2, DatumFactory.createInt8(1));
-    Tuple e = new VTuple(3);
+    VTuple e = new VTuple(3);
     e.put(0, DatumFactory.createInt8(4)); // 4
     e.put(1, DatumFactory.createInt8(2)); // 2
     e.put(2, DatumFactory.createInt8(3)); //x3 = 24
@@ -791,13 +791,13 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().longValue());
 
     Tuple beforeOverflow = partitioner.increment(s, BigInteger.valueOf(5), 2);
-    assertEquals(1, beforeOverflow.get(0).asInt8());
-    assertEquals(2, beforeOverflow.get(1).asInt8());
-    assertEquals(3, beforeOverflow.get(2).asInt8());
+    assertEquals(1, beforeOverflow.getInt8(0));
+    assertEquals(2, beforeOverflow.getInt8(1));
+    assertEquals(3, beforeOverflow.getInt8(2));
     Tuple overflow = partitioner.increment(beforeOverflow, BigInteger.valueOf(1), 2);
-    assertEquals(2, overflow.get(0).asInt8());
-    assertEquals(1, overflow.get(1).asInt8());
-    assertEquals(1, overflow.get(2).asInt8());
+    assertEquals(2, overflow.getInt8(0));
+    assertEquals(1, overflow.getInt8(1));
+    assertEquals(1, overflow.getInt8(2));
   }
 
   @Test
@@ -809,11 +809,11 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(3);
+    VTuple s = new VTuple(3);
     s.put(0, DatumFactory.createFloat8(1.1d));
     s.put(1, DatumFactory.createFloat8(1.1d));
     s.put(2, DatumFactory.createFloat8(1.1d));
-    Tuple e = new VTuple(3);
+    VTuple e = new VTuple(3);
     e.put(0, DatumFactory.createFloat8(4.1d)); // 4
     e.put(1, DatumFactory.createFloat8(2.1d)); // 2
     e.put(2, DatumFactory.createFloat8(3.1d)); //x3 = 24
@@ -824,13 +824,13 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().longValue());
 
     Tuple beforeOverflow = partitioner.increment(s, BigInteger.valueOf(5), 2);
-    assertTrue(1.1d == beforeOverflow.get(0).asFloat8());
-    assertTrue(2.1d == beforeOverflow.get(1).asFloat8());
-    assertTrue(3.1d == beforeOverflow.get(2).asFloat8());
+    assertTrue(1.1d == beforeOverflow.getFloat8(0));
+    assertTrue(2.1d == beforeOverflow.getFloat8(1));
+    assertTrue(3.1d == beforeOverflow.getFloat8(2));
     Tuple overflow = partitioner.increment(beforeOverflow, BigInteger.valueOf(1), 2);
-    assertTrue(2.1d == overflow.get(0).asFloat8());
-    assertTrue(1.1d == overflow.get(1).asFloat8());
-    assertTrue(1.1d == overflow.get(2).asFloat8());
+    assertTrue(2.1d == overflow.getFloat8(0));
+    assertTrue(1.1d == overflow.getFloat8(1));
+    assertTrue(1.1d == overflow.getFloat8(2));
   }
 
   @Test
@@ -842,11 +842,11 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(3);
+    VTuple s = new VTuple(3);
     s.put(0, DatumFactory.createInet4("127.0.1.1"));
     s.put(1, DatumFactory.createInet4("127.0.0.1"));
     s.put(2, DatumFactory.createInet4("128.0.0.253"));
-    Tuple e = new VTuple(3);
+    VTuple e = new VTuple(3);
     e.put(0, DatumFactory.createInet4("127.0.1.4")); // 4
     e.put(1, DatumFactory.createInet4("127.0.0.2")); // 2
     e.put(2, DatumFactory.createInet4("128.0.0.255")); //x3 = 24
@@ -857,13 +857,13 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().longValue());
 
     Tuple beforeOverflow = partitioner.increment(s, BigInteger.valueOf(5), 2);
-    assertTrue("127.0.1.1".equals(beforeOverflow.get(0).asChars()));
-    assertTrue("127.0.0.2".equals(beforeOverflow.get(1).asChars()));
-    assertTrue("128.0.0.255".equals(beforeOverflow.get(2).asChars()));
+    assertTrue("127.0.1.1".equals(beforeOverflow.getText(0)));
+    assertTrue("127.0.0.2".equals(beforeOverflow.getText(1)));
+    assertTrue("128.0.0.255".equals(beforeOverflow.getText(2)));
     Tuple overflow = partitioner.increment(beforeOverflow, BigInteger.valueOf(1), 2);
-    assertTrue("127.0.1.2".equals(overflow.get(0).asChars()));
-    assertTrue("127.0.0.1".equals(overflow.get(1).asChars()));
-    assertTrue("128.0.0.253".equals(overflow.get(2).asChars()));
+    assertTrue("127.0.1.2".equals(overflow.getText(0)));
+    assertTrue("127.0.0.1".equals(overflow.getText(1)));
+    assertTrue("128.0.0.253".equals(overflow.getText(2)));
   }
 
   @Test
@@ -874,10 +874,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createText("A"));
     s.put(1, DatumFactory.createText("F"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createText("R"));
     e.put(1, DatumFactory.createText("O"));
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -903,10 +903,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createText("A"));
     s.put(1, DatumFactory.createText("F"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createText("R"));
     e.put(1, DatumFactory.createText("O"));
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -925,10 +925,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createNullDatum());
     s.put(1, DatumFactory.createText("F"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createText("R"));
     e.put(1, DatumFactory.createNullDatum());
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -946,9 +946,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("AAA"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("ZZZ"));
 
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -975,9 +975,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("A1"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("A999975"));
 
     final int partNum = 2;
@@ -1007,9 +1007,9 @@ public class TestUniformRangePartition {
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
     sortSpecs[0].setDescOrder();
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("A999975"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("A1"));
 
     final int partNum = 48;
@@ -1038,9 +1038,9 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createText("AAA"));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createText("AAZ"));
 
     final int partNum = 4;
@@ -1070,10 +1070,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createNullDatum());
     s.put(1, DatumFactory.createNullDatum());
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createNullDatum());
     e.put(1, DatumFactory.createNullDatum());
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -1092,10 +1092,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createNullDatum());
     s.put(1, DatumFactory.createText("F"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createNullDatum());
     e.put(1, DatumFactory.createText("O"));
     TupleRange expected = new TupleRange(sortSpecs, s, e);
@@ -1121,10 +1121,10 @@ public class TestUniformRangePartition {
 
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(2);
+    VTuple s = new VTuple(2);
     s.put(0, DatumFactory.createInet4("127.0.1.10"));
     s.put(1, DatumFactory.createInet4("127.0.2.10"));
-    Tuple e = new VTuple(2);
+    VTuple e = new VTuple(2);
     e.put(0, DatumFactory.createInet4("127.0.1.20"));
     e.put(1, DatumFactory.createInet4("127.0.2.20"));
     TupleRange expected = new TupleRange(sortSpecs, s, e);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
index ae28233..e7e4f7d 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBNLJoinExec.java
@@ -89,7 +89,7 @@ public class TestBNLJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, schema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < OUTER_TUPLE_NUM; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createInt4(i), DatumFactory.createInt4(10 + i),
@@ -212,10 +212,10 @@ public class TestBNLJoinExec {
     exec.init();
     while ((tuple = exec.next()) != null) {
       count++;
-      assertTrue(i == tuple.get(0).asInt4());
-      assertTrue(i == tuple.get(1).asInt4());
-      assertTrue(("dept_" + i).equals(tuple.get(2).asChars()));
-      assertTrue(10 + i == tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1));
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue(10 + i == tuple.getInt4(3));
       i += 2;
     }
     exec.close();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
index 62144d2..5a7ba6a 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestBSTIndexExec.java
@@ -118,10 +118,10 @@ public class TestBSTIndexExec {
 
     FileAppender appender = (FileAppender)sm.getAppender(meta, schema, tablePath);
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < 10000; i++) {
       
-      Tuple key = new VTuple(this.idxSchema.size());
+      VTuple key = new VTuple(this.idxSchema.size());
       int rndKey = rnd.nextInt(250);
       if(this.randomValues.containsKey(rndKey)) {
         int t = this.randomValues.remove(rndKey) + 1;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
index 8aea2b6..8e2f234 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestExternalSortExec.java
@@ -86,7 +86,7 @@ public class TestExternalSortExec {
         .getAppender(employeeMeta, schema, employeePath);
     appender.enableStats();
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < numTuple; i++) {
       tuple.put(new Datum[] {
           DatumFactory.createInt4(rnd.nextInt(50)),

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterHashJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterHashJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterHashJoinExec.java
index 75ae439..fb6fd02 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterHashJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterHashJoinExec.java
@@ -107,7 +107,7 @@ public class TestFullOuterHashJoinExec {
     Appender appender1 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep3Meta, dep3Schema, dep3Path);
     appender1.init();
-    Tuple tuple = new VTuple(dep3Schema.size());
+    VTuple tuple = new VTuple(dep3Schema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createText("dept_" + i),
@@ -137,7 +137,7 @@ public class TestFullOuterHashJoinExec {
     Appender appender2 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(job3Meta, job3Schema, job3Path);
     appender2.init();
-    Tuple tuple2 = new VTuple(job3Schema.size());
+    VTuple tuple2 = new VTuple(job3Schema.size());
     for (int i = 1; i < 4; i++) {
       int x = 100 + i;
       tuple2.put(new Datum[] { DatumFactory.createInt4(100 + i),
@@ -177,7 +177,7 @@ public class TestFullOuterHashJoinExec {
     Appender appender3 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(emp3Meta, emp3Schema, emp3Path);
     appender3.init();
-    Tuple tuple3 = new VTuple(emp3Schema.size());
+    VTuple tuple3 = new VTuple(emp3Schema.size());
 
     for (int i = 1; i < 4; i += 2) {
       int x = 10 + i;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterMergeJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterMergeJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterMergeJoinExec.java
index 6804746..0963658 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterMergeJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestFullOuterMergeJoinExec.java
@@ -112,7 +112,7 @@ public class TestFullOuterMergeJoinExec {
     Appender appender1 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep3Meta, dep3Schema, dep3Path);
     appender1.init();
-    Tuple tuple = new VTuple(dep3Schema.size());
+    VTuple tuple = new VTuple(dep3Schema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createText("dept_" + i),
@@ -151,7 +151,7 @@ public class TestFullOuterMergeJoinExec {
     Appender appender4 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep4Meta, dep4Schema, dep4Path);
     appender4.init();
-    Tuple tuple4 = new VTuple(dep4Schema.size());
+    VTuple tuple4 = new VTuple(dep4Schema.size());
     for (int i = 0; i < 11; i++) {
       tuple4.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createText("dept_" + i),
@@ -183,7 +183,7 @@ public class TestFullOuterMergeJoinExec {
     Appender appender2 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(job3Meta, job3Schema, job3Path);
     appender2.init();
-    Tuple tuple2 = new VTuple(job3Schema.size());
+    VTuple tuple2 = new VTuple(job3Schema.size());
     for (int i = 1; i < 4; i++) {
       int x = 100 + i;
       tuple2.put(new Datum[] { DatumFactory.createInt4(100 + i),
@@ -223,7 +223,7 @@ public class TestFullOuterMergeJoinExec {
     Appender appender3 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(emp3Meta, emp3Schema, emp3Path);
     appender3.init();
-    Tuple tuple3 = new VTuple(emp3Schema.size());
+    VTuple tuple3 = new VTuple(emp3Schema.size());
 
     for (int i = 1; i < 4; i += 2) {
       int x = 10 + i;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
index b8f93e2..f1d4718 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashAntiJoinExec.java
@@ -86,7 +86,7 @@ public class TestHashAntiJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, employeeSchema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(employeeSchema.size());
+    VTuple tuple = new VTuple(employeeSchema.size());
 
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] {
@@ -199,10 +199,10 @@ public class TestHashAntiJoinExec {
     exec.init();
     while ((tuple = exec.next()) != null) {
       count++;
-      assertTrue(i == tuple.get(0).asInt4());
-      assertTrue(i == tuple.get(1).asInt4()); // expected empid [0, 2, 4, 6, 8]
-      assertTrue(("dept_" + i).equals(tuple.get(2).asChars()));
-      assertTrue(10 + i == tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1)); // expected empid [0, 2, 4, 6, 8]
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue(10 + i == tuple.getInt4(3));
 
       i += 2;
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
index acaf10c..77d524e 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashJoinExec.java
@@ -88,7 +88,7 @@ public class TestHashJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, employeeSchema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(employeeSchema.size());
+    VTuple tuple = new VTuple(employeeSchema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createInt4(i), DatumFactory.createInt4(10 + i),
@@ -173,10 +173,10 @@ public class TestHashJoinExec {
     exec.init();
     while ((tuple = exec.next()) != null) {
       count++;
-      assertTrue(i == tuple.get(0).asInt4());
-      assertTrue(i == tuple.get(1).asInt4());
-      assertTrue(("dept_" + i).equals(tuple.get(2).asChars()));
-      assertTrue(10 + i == tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1));
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue(10 + i == tuple.getInt4(3));
 
       i += 2;
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java
index 2241870..1146e85 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashPartitioner.java
@@ -46,31 +46,31 @@ public class TestHashPartitioner {
 
   @Test
   public final void testGetPartition() {   
-    Tuple tuple1 = new VTuple(3);    
+    VTuple tuple1 = new VTuple(3);
     tuple1.put(new Datum[] {
         DatumFactory.createInt4(1),
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(3)
     });
-    Tuple tuple2 = new VTuple(3);    
+    VTuple tuple2 = new VTuple(3);
     tuple2.put(new Datum[] {
         DatumFactory.createInt4(1),
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(4)
     });
-    Tuple tuple3 = new VTuple(3);    
+    VTuple tuple3 = new VTuple(3);
     tuple3.put(new Datum[] {
         DatumFactory.createInt4(1),
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(5)
     });
-    Tuple tuple4 = new VTuple(3);    
+    VTuple tuple4 = new VTuple(3);
     tuple4.put(new Datum[] {
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(3)
     });
-    Tuple tuple5 = new VTuple(3);    
+    VTuple tuple5 = new VTuple(3);
     tuple5.put(new Datum[] {
         DatumFactory.createInt4(2),
         DatumFactory.createInt4(2),

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
index b87799d..cc9560f 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestHashSemiJoinExec.java
@@ -87,7 +87,7 @@ public class TestHashSemiJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, employeeSchema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(employeeSchema.size());
+    VTuple tuple = new VTuple(employeeSchema.size());
 
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] {
@@ -205,10 +205,10 @@ public class TestHashSemiJoinExec {
     // expect result without duplicated tuples.
     while ((tuple = exec.next()) != null) {
       count++;
-      assertEquals(i, tuple.get(0).asInt4());
-      assertEquals(i, tuple.get(1).asInt4());
-      assertEquals("dept_" + i, tuple.get(2).asChars());
-      assertEquals(10 + i, tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1));
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue(10 + i == tuple.getInt4(3));
 
       i += 2;
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestLeftOuterHashJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestLeftOuterHashJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestLeftOuterHashJoinExec.java
index 4a1ca32..4b4ed45 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestLeftOuterHashJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestLeftOuterHashJoinExec.java
@@ -108,7 +108,7 @@ public class TestLeftOuterHashJoinExec {
     Appender appender1 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep3Meta, dep3Schema, dep3Path);
     appender1.init();
-    Tuple tuple = new VTuple(dep3Schema.size());
+    VTuple tuple = new VTuple(dep3Schema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
                     DatumFactory.createText("dept_" + i),
@@ -138,7 +138,7 @@ public class TestLeftOuterHashJoinExec {
     Appender appender2 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(job3Meta, job3Schema, job3Path);
     appender2.init();
-    Tuple tuple2 = new VTuple(job3Schema.size());
+    VTuple tuple2 = new VTuple(job3Schema.size());
     for (int i = 1; i < 4; i++) {
       int x = 100 + i;
       tuple2.put(new Datum[] { DatumFactory.createInt4(100 + i),
@@ -178,7 +178,7 @@ public class TestLeftOuterHashJoinExec {
     Appender appender3 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(emp3Meta, emp3Schema, emp3Path);
     appender3.init();
-    Tuple tuple3 = new VTuple(emp3Schema.size());
+    VTuple tuple3 = new VTuple(emp3Schema.size());
 
     for (int i = 1; i < 4; i += 2) {
       int x = 10 + i;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
index 5201774..370d03e 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestMergeJoinExec.java
@@ -88,7 +88,7 @@ public class TestMergeJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, employeeSchema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(employeeSchema.size());
+    VTuple tuple = new VTuple(employeeSchema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createInt4(i), DatumFactory.createInt4(10 + i),
@@ -184,10 +184,10 @@ public class TestMergeJoinExec {
     exec.init();
     while ((tuple = exec.next()) != null) {
       count++;
-      assertTrue(i == tuple.get(0).asInt4());
-      assertTrue(i == tuple.get(1).asInt4());
-      assertTrue(("dept_" + i).equals(tuple.get(2).asChars()));
-      assertTrue((10 + i) == tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1));
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue((10 + i) == tuple.getInt4(3));
 
       i += 2;
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java
index 97cc216..c73b89f 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java
@@ -86,7 +86,7 @@ public class TestNLJoinExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, schema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < 50; i++) {
       tuple.put(new Datum[] {
           DatumFactory.createInt4(i),
@@ -196,10 +196,10 @@ public class TestNLJoinExec {
     exec.init();
     while ((tuple = exec.next()) != null) {
       count++;
-      assertTrue(i == tuple.get(0).asInt4());
-      assertTrue(i == tuple.get(1).asInt4());
-      assertTrue(("dept_" + i).equals(tuple.get(2).asChars()));
-      assertTrue(10 + i == tuple.get(3).asInt4());
+      assertTrue(i == tuple.getInt4(0));
+      assertTrue(i == tuple.getInt4(1));
+      assertTrue(("dept_" + i).equals(tuple.getText(2)));
+      assertTrue(10 + i == tuple.getInt4(3));
       i += 2;
     }
     exec.close();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
index 7f92667..be519bf 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
@@ -123,7 +123,7 @@ public class TestPhysicalPlanner {
     Path employeePath = new Path(testDir, "employee.csv");
     Appender appender = sm.getAppender(employeeMeta, employeeSchema, employeePath);
     appender.init();
-    Tuple tuple = new VTuple(employeeSchema.size());
+    VTuple tuple = new VTuple(employeeSchema.size());
     for (int i = 0; i < 100; i++) {
       tuple.put(new Datum[] {DatumFactory.createText("name_" + i),
           DatumFactory.createInt4(i), DatumFactory.createText("dept_" + i)});
@@ -188,7 +188,7 @@ public class TestPhysicalPlanner {
         CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "score_large"), scoreSchmea, scoreLargeMeta,
         scoreLargePath.toUri());
 
-    Tuple tuple = new VTuple(scoreSchmea.size());
+    VTuple tuple = new VTuple(scoreSchmea.size());
     int m = 0;
     for (int i = 1; i <= 40000; i++) {
       for (int k = 3; k < 5; k++) { // |{3,4}| = 2
@@ -316,9 +316,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     exec.init();
     while ((tuple = exec.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     exec.close();
@@ -347,9 +347,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     exec.init();
     while ((tuple = exec.next()) != null) {
-      assertEquals(12, tuple.get(1).asInt4()); // sum
-      assertEquals(3, tuple.get(2).asInt4()); // max
-      assertEquals(1, tuple.get(3).asInt4()); // min
+      assertEquals(12, tuple.getInt4(1)); // sum
+      assertEquals(3, tuple.getInt4(2)); // max
+      assertEquals(1, tuple.getInt4(3)); // min
       i++;
     }
     exec.close();
@@ -391,9 +391,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     exec.init();
     while ((tuple = exec.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     assertEquals(10, i);
@@ -401,9 +401,9 @@ public class TestPhysicalPlanner {
     exec.rescan();
     i = 0;
     while ((tuple = exec.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     exec.close();
@@ -448,9 +448,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     int i = 0;
     while ((tuple = scanner.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     assertEquals(10, i);
@@ -545,9 +545,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     int i = 0;
     while ((tuple = scanner.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     assertEquals(10, i);
@@ -677,9 +677,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     int i = 0;
     while ((tuple = scanner.next()) != null) {
-      assertEquals(6, tuple.get(2).asInt4()); // sum
-      assertEquals(3, tuple.get(3).asInt4()); // max
-      assertEquals(1, tuple.get(4).asInt4()); // min
+      assertEquals(6, tuple.getInt4(2)); // sum
+      assertEquals(3, tuple.getInt4(3)); // max
+      assertEquals(1, tuple.getInt4(4)); // min
       i++;
     }
     assertEquals(10, i);
@@ -811,9 +811,9 @@ public class TestPhysicalPlanner {
     Tuple tuple;
     int i = 0;
     while ((tuple = scanner.next()) != null) {
-      assertEquals(60, tuple.get(0).asInt4()); // sum
-      assertEquals(3, tuple.get(1).asInt4()); // max
-      assertEquals(1, tuple.get(2).asInt4()); // min
+      assertEquals(60, tuple.getInt4(0)); // sum
+      assertEquals(3, tuple.getInt4(1)); // max
+      assertEquals(1, tuple.getInt4(2)); // min
       i++;
     }
     assertEquals(1, i);
@@ -848,9 +848,9 @@ public class TestPhysicalPlanner {
 
     exec.init();
     Tuple tuple = exec.next();
-    assertEquals(30, tuple.get(0).asInt8());
-    assertEquals(3, tuple.get(1).asInt4());
-    assertEquals(1, tuple.get(2).asInt4());
+    assertEquals(30, tuple.getInt8(0));
+    assertEquals(3, tuple.getInt4(1));
+    assertEquals(1, tuple.getInt4(2));
     assertNull(exec.next());
     exec.close();
   }
@@ -878,7 +878,7 @@ public class TestPhysicalPlanner {
     PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
     exec.init();
     Tuple tuple = exec.next();
-    assertEquals(30, tuple.get(0).asInt8());
+    assertEquals(30, tuple.getInt8(0));
     assertNull(exec.next());
     exec.close();
   }
@@ -954,8 +954,8 @@ public class TestPhysicalPlanner {
     exec.init();
     tuple = exec.next();
     exec.close();
-    assertEquals(true, tuple.get(0).asBool());
-    assertTrue(7.0d == tuple.get(1).asFloat8());
+    assertEquals(true, tuple.getBool(0));
+    assertTrue(7.0d == tuple.getFloat8(1));
 
     expr = analyzer.parse(QUERIES[13]);
     plan = planner.createPlan(defaultContext, expr);
@@ -966,7 +966,7 @@ public class TestPhysicalPlanner {
     exec.init();
     tuple = exec.next();
     exec.close();
-    assertEquals(DatumFactory.createBool(true), tuple.get(0));
+    assertEquals(DatumFactory.createBool(true), tuple.asDatum(0));
   }
 
   public final String [] createIndexStmt = {
@@ -1023,7 +1023,7 @@ public class TestPhysicalPlanner {
         "name_1", "name_2", "name_3", "name_4", "name_5");
     exec.init();
     while ((tuple = exec.next()) != null) {
-      assertTrue(expected.contains(tuple.get(0).asChars()));
+      assertTrue(expected.contains(tuple.getText(0)));
       cnt++;
     }
     exec.close();

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java
index 600f388..d7bc36b 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java
@@ -90,7 +90,7 @@ public class TestProgressExternalSortExec {
         .getAppender(employeeMeta, schema, employeePath);
     appender.enableStats();
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < numTuple; i++) {
       tuple.put(new Datum[] {
           DatumFactory.createInt4(rnd.nextInt(50)),

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterHashJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterHashJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterHashJoinExec.java
index 79db3bf..088de50 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterHashJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterHashJoinExec.java
@@ -103,7 +103,7 @@ public class TestRightOuterHashJoinExec {
     Appender appender1 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep3Meta, dep3Schema, dep3Path);
     appender1.init();
-    Tuple tuple = new VTuple(dep3Schema.size());
+    VTuple tuple = new VTuple(dep3Schema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
                     DatumFactory.createText("dept_" + i),
@@ -133,7 +133,7 @@ public class TestRightOuterHashJoinExec {
     Appender appender2 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(job3Meta, job3Schema, job3Path);
     appender2.init();
-    Tuple tuple2 = new VTuple(job3Schema.size());
+    VTuple tuple2 = new VTuple(job3Schema.size());
     for (int i = 1; i < 4; i++) {
       int x = 100 + i;
       tuple2.put(new Datum[] { DatumFactory.createInt4(100 + i),
@@ -173,7 +173,7 @@ public class TestRightOuterHashJoinExec {
     Appender appender3 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(emp3Meta, emp3Schema, emp3Path);
     appender3.init();
-    Tuple tuple3 = new VTuple(emp3Schema.size());
+    VTuple tuple3 = new VTuple(emp3Schema.size());
 
     for (int i = 1; i < 4; i += 2) {
       int x = 10 + i;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterMergeJoinExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterMergeJoinExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterMergeJoinExec.java
index b67dc09..9d01c8f 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterMergeJoinExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestRightOuterMergeJoinExec.java
@@ -110,7 +110,7 @@ public class TestRightOuterMergeJoinExec {
     Appender appender1 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep3Meta, dep3Schema, dep3Path);
     appender1.init();
-    Tuple tuple = new VTuple(dep3Schema.size());
+    VTuple tuple = new VTuple(dep3Schema.size());
     for (int i = 0; i < 10; i++) {
       tuple.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createText("dept_" + i),
@@ -149,7 +149,7 @@ public class TestRightOuterMergeJoinExec {
     Appender appender4 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(dep4Meta, dep4Schema, dep4Path);
     appender4.init();
-    Tuple tuple4 = new VTuple(dep4Schema.size());
+    VTuple tuple4 = new VTuple(dep4Schema.size());
     for (int i = 0; i < 11; i++) {
       tuple4.put(new Datum[] { DatumFactory.createInt4(i),
           DatumFactory.createText("dept_" + i),
@@ -181,7 +181,7 @@ public class TestRightOuterMergeJoinExec {
     Appender appender2 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(job3Meta, job3Schema, job3Path);
     appender2.init();
-    Tuple tuple2 = new VTuple(job3Schema.size());
+    VTuple tuple2 = new VTuple(job3Schema.size());
     for (int i = 1; i < 4; i++) {
       int x = 100 + i;
       tuple2.put(new Datum[] { DatumFactory.createInt4(100 + i),
@@ -221,7 +221,7 @@ public class TestRightOuterMergeJoinExec {
     Appender appender3 = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(emp3Meta, emp3Schema, emp3Path);
     appender3.init();
-    Tuple tuple3 = new VTuple(emp3Schema.size());
+    VTuple tuple3 = new VTuple(emp3Schema.size());
 
     for (int i = 1; i < 4; i += 2) {
       int x = 10 + i;

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java
index 6e0aa8e..0f92bec 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java
@@ -84,7 +84,7 @@ public class TestSortExec {
     Appender appender = ((FileTablespace) TableSpaceManager.getFileStorageManager(conf))
         .getAppender(employeeMeta, schema, tablePath);
     appender.init();
-    Tuple tuple = new VTuple(schema.size());
+    VTuple tuple = new VTuple(schema.size());
     for (int i = 0; i < 100; i++) {
       tuple.put(new Datum[] {
           DatumFactory.createInt4(rnd.nextInt(5)),
@@ -128,7 +128,7 @@ public class TestSortExec {
     Datum curVal;
     exec.init();
     while ((tuple = exec.next()) != null) {
-      curVal = tuple.get(0);
+      curVal = tuple.asDatum(0);
       if (preVal != null) {
         assertTrue(preVal.lessThanEqual(curVal).asBool());
       }
@@ -149,9 +149,9 @@ public class TestSortExec {
     schema.addColumn("l_orderkey", Type.INT8);
     SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema);
 
-    Tuple s = new VTuple(1);
+    VTuple s = new VTuple(1);
     s.put(0, DatumFactory.createInt8(0));
-    Tuple e = new VTuple(1);
+    VTuple e = new VTuple(1);
     e.put(0, DatumFactory.createInt8(6000000000l));
     TupleRange expected = new TupleRange(sortSpecs, s, e);
     RangePartitionAlgorithm partitioner

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestTupleSorter.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestTupleSorter.java b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestTupleSorter.java
index 9cc477a..ea1214e 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestTupleSorter.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/physical/TestTupleSorter.java
@@ -100,7 +100,7 @@ public class TestTupleSorter {
         Tuple tuple = Iterators.get(iterator, LENGTH / result1.length - 1);
         StringBuilder builder = new StringBuilder();
         for (int keyIndex : keyIndices) {
-          builder.append(tuple.get(keyIndex).asChars());
+          builder.append(tuple.getText(keyIndex));
         }
         result1[i] = builder.toString();
       }
@@ -117,7 +117,7 @@ public class TestTupleSorter {
         Tuple tuple = Iterators.get(iterator, LENGTH / result2.length - 1);
         StringBuilder builder = new StringBuilder();
         for (int keyIndex : keyIndices) {
-          builder.append(tuple.get(keyIndex).asChars());
+          builder.append(tuple.getText(keyIndex));
         }
         result2[i] = builder.toString();
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java b/tajo-core/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java
index c1c07b8..4a3565e 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java
@@ -70,8 +70,7 @@ public class TestTupleUtil {
     schema.addColumn("col11", Type.INET4);
     //schema.addColumn("col11", DataType.IPv6);
     
-    Tuple tuple = new VTuple(11);
-    tuple.put(new Datum[] {
+    Tuple tuple = new VTuple(new Datum[] {
         DatumFactory.createBool(true),
         DatumFactory.createBit((byte) 0x99),
         DatumFactory.createChar('7'),
@@ -95,8 +94,8 @@ public class TestTupleUtil {
 
   @Test
   public final void testGetPartitions() {
-    Tuple sTuple = new VTuple(7);
-    Tuple eTuple = new VTuple(7);
+    VTuple sTuple = new VTuple(7);
+    VTuple eTuple = new VTuple(7);
 
     Schema schema = new Schema();
 
@@ -155,10 +154,10 @@ public class TestTupleUtil {
     path = new Path("hdfs://tajo/warehouse/partition_test/key1=123");
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, true);
     assertNotNull(tuple);
-    assertEquals(DatumFactory.createInt8(123), tuple.get(0));
+    assertEquals(DatumFactory.createInt8(123), tuple.asDatum(0));
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, false);
     assertNotNull(tuple);
-    assertEquals(DatumFactory.createInt8(123), tuple.get(0));
+    assertEquals(DatumFactory.createInt8(123), tuple.asDatum(0));
 
     path = new Path("hdfs://tajo/warehouse/partition_test/key1=123/part-0000"); // wrong cases;
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, true);
@@ -169,12 +168,12 @@ public class TestTupleUtil {
     path = new Path("hdfs://tajo/warehouse/partition_test/key1=123/key2=abc");
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, true);
     assertNotNull(tuple);
-    assertEquals(DatumFactory.createInt8(123), tuple.get(0));
-    assertEquals(DatumFactory.createText("abc"), tuple.get(1));
+    assertEquals(DatumFactory.createInt8(123), tuple.asDatum(0));
+    assertEquals(DatumFactory.createText("abc"), tuple.asDatum(1));
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, false);
     assertNotNull(tuple);
-    assertEquals(DatumFactory.createInt8(123), tuple.get(0));
-    assertEquals(DatumFactory.createText("abc"), tuple.get(1));
+    assertEquals(DatumFactory.createInt8(123), tuple.asDatum(0));
+    assertEquals(DatumFactory.createText("abc"), tuple.asDatum(1));
 
 
     path = new Path("hdfs://tajo/warehouse/partition_test/key1=123/key2=abc/part-0001");
@@ -183,7 +182,7 @@ public class TestTupleUtil {
 
     tuple = PartitionedTableRewriter.buildTupleFromPartitionPath(schema, path, false);
     assertNotNull(tuple);
-    assertEquals(DatumFactory.createInt8(123), tuple.get(0));
-    assertEquals(DatumFactory.createText("abc"), tuple.get(1));
+    assertEquals(DatumFactory.createInt8(123), tuple.asDatum(0));
+    assertEquals(DatumFactory.createText("abc"), tuple.asDatum(1));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/master/TestNonForwardQueryResultSystemScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/master/TestNonForwardQueryResultSystemScanner.java b/tajo-core/src/test/java/org/apache/tajo/master/TestNonForwardQueryResultSystemScanner.java
index fb149b2..6322732 100644
--- a/tajo-core/src/test/java/org/apache/tajo/master/TestNonForwardQueryResultSystemScanner.java
+++ b/tajo-core/src/test/java/org/apache/tajo/master/TestNonForwardQueryResultSystemScanner.java
@@ -240,15 +240,15 @@ public class TestNonForwardQueryResultSystemScanner {
 
       @Override
       protected boolean matchesSafely(Tuple item, Description mismatchDescription) {
-        Datum datum = item.get(fieldId);
         Object itemValue = null;
-        
-        if (datum.type() == Type.TEXT) {
-          itemValue = datum.asChars();
-        } else if (datum.type() == Type.INT4) {
-          itemValue = datum.asInt4();
-        } else if (datum.type() == Type.INT8) {
-          itemValue = datum.asInt8();
+
+        Type type = item.type(fieldId);
+        if (type == Type.TEXT) {
+          itemValue = item.getText(fieldId);
+        } else if (type == Type.INT4) {
+          itemValue = item.getInt4(fieldId);
+        } else if (type == Type.INT8) {
+          itemValue = item.getInt8(fieldId);
         }
         
         if (itemValue != null && matcher.matches(itemValue)) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-core/src/test/java/org/apache/tajo/storage/TestRowFile.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/storage/TestRowFile.java b/tajo-core/src/test/java/org/apache/tajo/storage/TestRowFile.java
index 3ab2df6..b19a2e5 100644
--- a/tajo-core/src/test/java/org/apache/tajo/storage/TestRowFile.java
+++ b/tajo-core/src/test/java/org/apache/tajo/storage/TestRowFile.java
@@ -127,8 +127,8 @@ public class TestRowFile {
       scanner = new RowFile.RowFileScanner(conf, schema, meta, fragment);
       scanner.init();
       while ((tuple=scanner.next()) != null) {
-        if (!idSet.remove(tuple.get(0).asInt4())) {
-          System.out.println("duplicated! " + tuple.get(0).asInt4());
+        if (!idSet.remove(tuple.getInt4(0))) {
+          System.out.println("duplicated! " + tuple.getInt4(0));
         }
         tupleCnt++;
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
----------------------------------------------------------------------
diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
index 30fc9ee..9ae1837 100644
--- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
+++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
@@ -18,12 +18,14 @@
 
 package org.apache.tajo.jdbc;
 
+import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.IntervalDatum;
 import org.apache.tajo.datum.NullDatum;
 import org.apache.tajo.datum.ProtobufDatum;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.util.datetime.TimeMeta;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -49,13 +51,18 @@ public class MetaDataTuple implements Tuple {
   }
 
   @Override
-  public boolean isNull(int fieldid) {
+  public boolean isBlank(int fieldid) {
+    return values.get(fieldid) == null;
+  }
+
+  @Override
+  public boolean isBlankOrNull(int fieldid) {
     return values.get(fieldid) == null || values.get(fieldid).isNull();
   }
 
   @Override
-  public boolean isNotNull(int fieldid) {
-    return !isNull(fieldid);
+  public void put(int fieldId, Tuple tuple) {
+    this.put(fieldId, tuple.asDatum(fieldId));
   }
 
   @Override
@@ -69,22 +76,24 @@ public class MetaDataTuple implements Tuple {
   }
 
   @Override
-  public void put(int fieldId, Datum[] values) {
-    throw new UnsupportedException("put");
+  public void put(Datum[] values) {
+    for (int i = 0; i < values.length; i++) {
+      this.values.set(i, values[i]);
+    }
   }
 
   @Override
-  public void put(int fieldId, Tuple tuple) {
-    throw new UnsupportedException("put");
+  public TajoDataTypes.Type type(int fieldId) {
+    return values.get(fieldId).type();
   }
 
   @Override
-  public void put(Datum[] values) {
-    throw new UnsupportedException("put");
+  public int size(int fieldId) {
+    return values.get(fieldId).size();
   }
 
   @Override
-  public Datum get(int fieldId) {
+  public Datum asDatum(int fieldId) {
     return values.get(fieldId);
   }
 
@@ -100,17 +109,17 @@ public class MetaDataTuple implements Tuple {
 
   @Override
   public boolean getBool(int fieldId) {
-    throw new UnsupportedException("getBool");
+    return values.get(fieldId).asBool();
   }
 
   @Override
   public byte getByte(int fieldId) {
-    throw new UnsupportedException("getByte");
+    return values.get(fieldId).asByte();
   }
 
   @Override
   public char getChar(int fieldId) {
-    throw new UnsupportedException("getChar");
+    return values.get(fieldId).asChar();
   }
 
   @Override
@@ -119,33 +128,43 @@ public class MetaDataTuple implements Tuple {
   }
 
   @Override
+  public byte[] getTextBytes(int fieldId) {
+    return values.get(fieldId).asTextBytes();
+  }
+
+  @Override
   public short getInt2(int fieldId) {
-    return (short)Integer.parseInt(values.get(fieldId).toString());
+    return values.get(fieldId).asInt2();
   }
 
   @Override
   public int getInt4(int fieldId) {
-    return Integer.parseInt(values.get(fieldId).toString());
+    return values.get(fieldId).asInt4();
   }
 
   @Override
   public long getInt8(int fieldId) {
-    return Long.parseLong(values.get(fieldId).toString());
+    return values.get(fieldId).asInt8();
   }
 
   @Override
   public float getFloat4(int fieldId) {
-    return Float.parseFloat(values.get(fieldId).toString());
+    return values.get(fieldId).asFloat4();
   }
 
   @Override
   public double getFloat8(int fieldId) {
-    return Float.parseFloat(values.get(fieldId).toString());
+    return values.get(fieldId).asFloat8();
   }
 
   @Override
   public String getText(int fieldId) {
-    return values.get(fieldId).toString();
+    return values.get(fieldId).asChars();
+  }
+
+  @Override
+  public TimeMeta getTimeDate(int fieldId) {
+    return values.get(fieldId).asTimeMeta();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
----------------------------------------------------------------------
diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
index 8f5bed6..eb3595f 100644
--- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
+++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
@@ -20,7 +20,6 @@ package org.apache.tajo.jdbc;
 
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.datum.Datum;
 import org.apache.tajo.storage.Tuple;
 
 import java.io.IOException;
@@ -70,20 +69,11 @@ public class TajoMetaDataResultSet extends TajoResultSetBase {
 
   @Override
   public String getString(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    if(datum == null) {
-      return null;
-    }
-
-    return datum.asChars();
+    return cur.getText(fieldId - 1);
   }
 
   @Override
   public String getString(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    if(datum == null) {
-      return null;
-    }
-    return datum.asChars();
+    return cur.getText(findColumn(name));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java b/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
index e24cf6e..7467dcd 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
@@ -882,7 +882,7 @@ public class ExprAnnotator extends BaseAlgebraVisitor<ExprAnnotator.Context, Eva
       time = DateTimeUtil.toTime(times[0], times[1], times[2], 0);
     }
     TimeDatum timeDatum = new TimeDatum(time);
-    TimeMeta tm = timeDatum.toTimeMeta();
+    TimeMeta tm = timeDatum.asTimeMeta();
 
     if (ctx.queryContext.containsKey(SessionVars.TIMEZONE)) {
       TimeZone tz = TimeZone.getTimeZone(ctx.queryContext.get(SessionVars.TIMEZONE));

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-plan/src/main/java/org/apache/tajo/plan/expr/FieldEval.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/FieldEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/FieldEval.java
index 870970b..2b301b6 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/FieldEval.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/FieldEval.java
@@ -58,7 +58,7 @@ public class FieldEval extends EvalNode implements Cloneable {
   @SuppressWarnings("unchecked")
 	public Datum eval(Tuple tuple) {
     super.eval(tuple);
-	  return tuple.get(fieldId);
+	  return tuple.asDatum(fieldId);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-plan/src/main/java/org/apache/tajo/plan/function/PythonAggFunctionInvoke.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/PythonAggFunctionInvoke.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/PythonAggFunctionInvoke.java
index c7fddf9..babc6ac 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/PythonAggFunctionInvoke.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/PythonAggFunctionInvoke.java
@@ -105,7 +105,7 @@ public class PythonAggFunctionInvoke extends AggFunctionInvoke implements Clonea
 
   @Override
   public void merge(FunctionContext context, Tuple params) {
-    if (params.get(0) instanceof NullDatum) {
+    if (params.isBlankOrNull(0)) {
       return;
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/tajo-plan/src/main/java/org/apache/tajo/plan/function/python/PythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/python/PythonScriptEngine.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/python/PythonScriptEngine.java
index 0066c39..74c0e5a 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/python/PythonScriptEngine.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/python/PythonScriptEngine.java
@@ -477,7 +477,7 @@ public class PythonScriptEngine extends TajoScriptEngine {
     }
     Datum result;
     try {
-      result = outputHandler.getNext().get(0);
+      result = outputHandler.getNext().asDatum(0);
     } catch (Exception e) {
       throw new RuntimeException("Problem getting output: " + e.getMessage(), e);
     }
@@ -594,7 +594,7 @@ public class PythonScriptEngine extends TajoScriptEngine {
     }
     Datum result;
     try {
-      result = outputHandler.getNext().get(0);
+      result = outputHandler.getNext().asDatum(0);
     } catch (Exception e) {
       throw new RuntimeException("Problem getting output: " + e.getMessage(), e);
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/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 9db6632..78404b0 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
@@ -56,7 +56,17 @@ public class CSVLineSerializer extends TextLineSerializer {
     int writtenBytes = 0;
 
     for (int i = 0; i < input.size(); i++) {
-      writtenBytes += serializeDatum(out, input.get(i), schema.getColumn(i).getDataType());
+      Datum datum = input.asDatum(i);
+      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());
+
+      writtenBytes += serde.serialize(out, datum, schema.getColumn(i).getDataType(), nullChars);
 
       if (input.size() - 1 > i) {
         out.write(delimiter);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5c2aee23/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 879373b..c22a0f2 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
@@ -112,7 +112,7 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
         break;
       case TIME:
         if (hasTimezone) {
-          bytes = ((TimeDatum) datum).asChars(timezone, true).getBytes();
+          bytes = ((TimeDatum) datum).toString(timezone, true).getBytes();
         } else {
           bytes = datum.asTextBytes();
         }
@@ -121,7 +121,7 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
         break;
       case TIMESTAMP:
         if (hasTimezone) {
-          bytes = ((TimestampDatum) datum).asChars(timezone, true).getBytes();
+          bytes = ((TimestampDatum) datum).toString(timezone, true).getBytes();
         } else {
           bytes = datum.asTextBytes();
         }


Mime
View raw message