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

git commit: TAJO-548: Investigate frequent young gc. (Min Zhou via hyunsik)

Updated Branches:
  refs/heads/master 8e859fb10 -> 9de88cb99


TAJO-548: Investigate frequent young gc. (Min Zhou via hyunsik)


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

Branch: refs/heads/master
Commit: 9de88cb9940e2f921d2814bac691f2227c5b963a
Parents: 8e859fb
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Feb 12 15:15:23 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Feb 12 15:15:23 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |   2 +
 .../main/java/org/apache/tajo/util/Bytes.java   | 336 +++++++++++++++++++
 .../java/org/apache/tajo/util/TestBytes.java    |  47 +++
 .../queries/TestCTASQuery/CtasWithGroupby.sql   |   2 +-
 .../queries/TestCTASQuery/CtasWithLimit.sql     |   2 +-
 .../queries/TestCTASQuery/CtasWithOrderby.sql   |   2 +-
 .../queries/TestCTASQuery/CtasWithUnion.sql     |   2 +-
 .../testCtasWithColumnedPartition.sql           |   2 +-
 .../TestCTASQuery/testCtasWithGroupby.result    |  10 +-
 .../TestCTASQuery/testCtasWithLimit.result      |   6 +-
 .../TestCTASQuery/testCtasWithOrderby.result    |  10 +-
 .../storage/TextSerializerDeserializer.java     |   6 +-
 12 files changed, 406 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 34fadb6..65cf31b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -130,6 +130,8 @@ Release 0.8.0 - unreleased
 
   IMPROVEMENTS
 
+    TAJO-548: Investigate frequent young gc. (Min Zhou via hyunsik)
+
     TAJO-584: Improve distributed merge sort. (hyunsik)
 
     TAJO-36: Improve ExternalSortExec with N-merge sort and final pass

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-common/src/main/java/org/apache/tajo/util/Bytes.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/Bytes.java b/tajo-common/src/main/java/org/apache/tajo/util/Bytes.java
index 0b5a470..f9ba923 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/Bytes.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/Bytes.java
@@ -1800,4 +1800,340 @@ public class Bytes {
       amt -= ret;
     }
   }
+
+  /**
+   * Parses the byte array argument as if it was an int value and returns the
+   * result. Throws NumberFormatException if the byte array does not represent an
+   * int quantity.
+   *
+   * @return int the value represented by the argument
+   * @throws NumberFormatException if the argument could not be parsed as an int quantity.
+   */
+  public static int parseInt(byte[] bytes, int start, int length) {
+    return parseInt(bytes, start, length, 10);
+  }
+
+  /**
+   * Parses the byte array argument as if it was an int value and returns the
+   * result. Throws NumberFormatException if the byte array does not represent an
+   * int quantity. The second argument specifies the radix to use when parsing
+   * the value.
+   *
+   * @param radix  the base to use for conversion.
+   * @return the value represented by the argument
+   * @throws NumberFormatException if the argument could not be parsed as an int quantity.
+   */
+  public static int parseInt(byte[] bytes, int start, int length, int radix) {
+    if (bytes == null) {
+      throw new NumberFormatException("String is null");
+    }
+    if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {
+      throw new NumberFormatException("Invalid radix: " + radix);
+    }
+    if (length == 0) {
+      throw new NumberFormatException("Empty byte array!");
+    }
+    int offset = start;
+    boolean negative = bytes[start] == '-';
+    if (negative || bytes[start] == '+') {
+      offset++;
+      if (length == 1) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+    }
+
+    return parse(bytes, start, length, offset, radix, negative);
+  }
+
+  /**
+   * @param bytes
+   * @param start
+   * @param length
+   * @param radix    the base to use for conversion.
+   * @param offset   the starting position after the sign (if exists)
+   * @param radix    the base to use for conversion.
+   * @param negative whether the number is negative.
+   * @return the value represented by the argument
+   * @throws NumberFormatException if the argument could not be parsed as an int quantity.
+   */
+  private static int parse(byte[] bytes, int start, int length, int offset,
+                           int radix, boolean negative) {
+    byte separator = '.';
+    int max = Integer.MIN_VALUE / radix;
+    int result = 0, end = start + length;
+    while (offset < end) {
+      int digit = digit(bytes[offset++], radix);
+      if (digit == -1) {
+        if (bytes[offset - 1] == separator) {
+          // We allow decimals and will return a truncated integer in that case.
+          // Therefore we won't throw an exception here (checking the fractional
+          // part happens below.)
+          break;
+        }
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+      if (max > result) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+      int next = result * radix - digit;
+      if (next > result) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+      result = next;
+    }
+
+    // This is the case when we've encountered a decimal separator. The fractional
+    // part will not change the number, but we will verify that the fractional part
+    // is well formed.
+    while (offset < end) {
+      int digit = digit(bytes[offset++], radix);
+      if (digit == -1) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+    }
+
+    if (!negative) {
+      result = -result;
+      if (result < 0) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+    }
+    return result;
+  }
+
+
+  /**
+   * Returns the digit represented by character b.
+   *
+   * @param b     The ascii code of the character
+   * @param radix The radix
+   * @return -1 if it's invalid
+   */
+  private static int digit(int b, int radix) {
+    int r = -1;
+    if (b >= '0' && b <= '9') {
+      r = b - '0';
+    } else if (b >= 'A' && b <= 'Z') {
+      r = b - 'A' + 10;
+    } else if (b >= 'a' && b <= 'z') {
+      r = b - 'a' + 10;
+    }
+    if (r >= radix) {
+      r = -1;
+    }
+    return r;
+  }
+
+  /**
+   * Returns the digit represented by character b, radix is 10
+   *
+   * @param b The ascii code of the character
+   * @return -1 if it's invalid
+   */
+  private static boolean isDigit(int b) {
+    return (b >= '0' && b <= '9');
+  }
+
+  private static final int maxExponent = 511;	/* Largest possible base 10 exponent.  Any
+                                               * exponent larger than this will already
+                                               * produce underflow or overflow, so there's
+                                               * no need to worry about additional digits.
+                                               */
+  public static final double powersOf10[] = {	/* Table giving binary powers of 10.  Entry */
+      10.,		 	                              /* is 10^2^i.  Used to convert decimal */
+      100.,		 	                              /* exponents into floating-point numbers. */
+      1.0e4,
+      1.0e8,
+      1.0e16,
+      1.0e32,
+      1.0e64,
+      1.0e128,
+      1.0e256
+  };
+
+  /**
+   * Parses the byte array argument as if it was a double value and returns the
+   * result. Throws NumberFormatException if the byte array does not represent a
+   * double value.
+   *
+   * @return double, the value represented by the argument
+   * @throws NumberFormatException if the argument could not be parsed as a double
+   */
+  public static double parseDouble(byte[] bytes, int start, int length) {
+    if (bytes == null) {
+      throw new NumberFormatException("String is null");
+    }
+    if (length == 0) {
+      throw new NumberFormatException("Empty byte array!");
+    }
+
+    /*
+     * Strip off leading blanks
+     */
+    int offset = start;
+    int end = start + length;
+
+    while (offset < end && bytes[offset] == ' ') {
+      offset++;
+    }
+    if (offset == end) {
+      throw new NumberFormatException("blank byte array!");
+    }
+
+    /*
+     * check for a sign.
+     */
+    boolean sign = false;
+    if (bytes[offset] == '-') {
+      sign = true;
+      offset++;
+    } else if (bytes[offset] == '+') {
+      offset++;
+    }
+    if (offset == end) {
+      throw new NumberFormatException("the byte array only has a sign!");
+    }
+
+    /*
+     * Count the number of digits in the mantissa (including the decimal
+     * point), and also locate the decimal point.
+     */
+    int mantSize = 0;		      /* Number of digits in mantissa. */
+    int decicalOffset = -1;   /* Number of mantissa digits BEFORE decimal point. */
+    for (; offset < end; offset++) {
+      if (!isDigit(bytes[offset])) {
+        if ((bytes[offset] != '.') || (decicalOffset >= 0)) {
+          break;
+        }
+        decicalOffset = mantSize;
+      }
+      mantSize++;
+    }
+
+    int exponentOffset = offset; /* Temporarily holds location of exponent in bytes. */
+
+    /*
+     * Now suck up the digits in the mantissa.  Use two integers to
+     * collect 9 digits each (this is faster than using floating-point).
+     * If the mantissa has more than 18 digits, ignore the extras, since
+     * they can't affect the value anyway.
+     */
+    offset -= mantSize;
+    if (decicalOffset < 0) {
+      decicalOffset = mantSize;
+    } else {
+      mantSize -= 1;			       /* One of the digits was the decimal point. */
+    }
+    int fracExponent;            /* Exponent that derives from the fractional
+                                  * part.  Under normal circumstatnces, it is
+				                          * the negative of the number of digits in F.
+				                          * However, if I is very long, the last digits
+				                          * of I get dropped (otherwise a long I with a
+				                          * large negative exponent could cause an
+				                          * unnecessary overflow on I alone).  In this
+				                          * case, fracExp is incremented one for each
+				                          * dropped digit. */
+    if (mantSize > 18) {
+      fracExponent = decicalOffset - 18;
+      mantSize = 18;
+    } else {
+      fracExponent = decicalOffset - mantSize;
+    }
+
+    if (mantSize == 0) {
+      return 0.0;
+    }
+
+    int frac1 = 0;
+    for (; mantSize > 9; mantSize--) {
+      int b = bytes[offset];
+      offset++;
+      if (b == '.') {
+        b = bytes[offset];
+        offset++;
+      }
+      frac1 = 10 * frac1 + (b - '0');
+    }
+    int frac2 = 0;
+    for (; mantSize > 0; mantSize--) {
+      int b = bytes[offset];
+      offset++;
+      if (b == '.') {
+        b = bytes[offset];
+        offset++;
+      }
+      frac2 = 10 * frac2 + (b - '0');
+    }
+    double fraction = (1.0e9 * frac1) + frac2;
+
+    /*
+     * Skim off the exponent.
+     */
+    int exponent = 0;            /* Exponent read from "EX" field. */
+    offset = exponentOffset;
+    boolean expSign = false;
+
+    if (offset < end) {
+      if ((bytes[offset] != 'E') && (bytes[offset] != 'e')) {
+        throw new NumberFormatException(new String(bytes, start,
+            length));
+      }
+
+      // (bytes[offset] == 'E') || (bytes[offset] == 'e')
+      offset++;
+
+      if (bytes[offset] == '-') {
+        expSign = true;
+        offset++;
+      } else if (bytes[offset] == '+') {
+        offset++;
+      }
+
+      for (; offset < end; offset++) {
+        if (isDigit(bytes[offset])) {
+          exponent = exponent * 10 + (bytes[offset] - '0');
+        } else {
+          throw new NumberFormatException(new String(bytes, start,
+              length));
+        }
+      }
+    }
+
+    exponent = expSign ? (fracExponent - exponent) : (fracExponent + exponent);
+
+    /*
+     * Generate a floating-point number that represents the exponent.
+     * Do this by processing the exponent one bit at a time to combine
+     * many powers of 2 of 10. Then combine the exponent with the
+     * fraction.
+     */
+    if (exponent < 0) {
+      expSign = true;
+      exponent = -exponent;
+    } else {
+      expSign = false;
+    }
+    if (exponent > maxExponent) {
+      throw new NumberFormatException(new String(bytes, start,
+          length));
+    }
+
+    double dblExp = 1.0;
+    for (int i = 0; exponent != 0; exponent >>= 1, i++) {
+      if ((exponent & 01) == 01) {
+        dblExp *= powersOf10[i];
+      }
+    }
+
+    fraction = (expSign) ? (fraction / dblExp) : (fraction * dblExp);
+
+    return sign ? (-fraction) : fraction;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-common/src/test/java/org/apache/tajo/util/TestBytes.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/util/TestBytes.java b/tajo-common/src/test/java/org/apache/tajo/util/TestBytes.java
index 98d8eac..c26bf7d 100644
--- a/tajo-common/src/test/java/org/apache/tajo/util/TestBytes.java
+++ b/tajo-common/src/test/java/org/apache/tajo/util/TestBytes.java
@@ -61,4 +61,51 @@ public class TestBytes {
     assertArrayEquals(textArray[1].getBytes(), bytesArray[1]);
     assertNull(bytesArray[2]);
   }
+
+  @Test
+  public void testParseInt() {
+    int int1 = 0;
+    byte[] bytes1 = Double.toString(int1).getBytes();
+    assertEquals(int1, Bytes.parseInt(bytes1, 0, bytes1.length));
+
+    int int2 = -7;
+    byte[] bytes2 = Double.toString(int2).getBytes();
+    assertEquals(int2, Bytes.parseInt(bytes2, 0, bytes2.length));
+
+    int int3 = +128;
+    byte[] bytes3 = Double.toString(int3).getBytes();
+    assertEquals(int3, Bytes.parseInt(bytes3, 0, bytes3.length));
+
+    int int4 = 4;
+    byte[] bytes4 = Double.toString(int4).getBytes();
+    assertEquals(int4, Bytes.parseInt(bytes4, 0, bytes4.length));
+
+    byte[] bytes5 = "0123-456789".getBytes();
+    assertEquals(-456, Bytes.parseInt(bytes5, 4, 4));
+
+  }
+
+  @Test
+  public void testParseDouble() {
+    double double1 = 2.0015E7;
+    byte[] bytes1 = Double.toString(double1).getBytes();
+    assertEquals(double1, Bytes.parseDouble(bytes1, 0, bytes1.length), 0.0);
+
+    double double2 = 1.345E-7;
+    byte[] bytes2 = Double.toString(double2).getBytes();
+    assertEquals(double2, Bytes.parseDouble(bytes2, 0, bytes2.length), 0.0);
+
+    double double3 = -1.345E-7;
+    byte[] bytes3 = Double.toString(double3).getBytes();
+    assertEquals(double3, Bytes.parseDouble(bytes3, 0, bytes3.length), 0.0);
+
+    double double4 = 4;
+    byte[] bytes4 = Double.toString(double4).getBytes();
+    assertEquals(double4, Bytes.parseDouble(bytes4, 0, bytes4.length), 0.0);
+
+    byte[] bytes5 = "0123456789.012345E012345".getBytes();
+    assertEquals(6789.012345E01, Bytes.parseDouble(bytes5, 6, 14), 0.0);
+
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
index 7c3895e..c2d7604 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
@@ -1,2 +1,2 @@
-create table testCtasWithGroupby (col1 int4, col2 int4) partition by column(key float8) as
+create table testCtasWithGroupby (col1 float, col2 float) partition by column(key float8) as
 select sum(l_orderkey) as total1, avg(l_partkey) as total2, l_quantity as key from lineitem group by l_quantity;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
index 9c99a66..fb4eba3 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
@@ -1,4 +1,4 @@
-create table testCtasWithLimit (col1 int4, col2 int4) partition by column(key float8) as
+create table testCtasWithLimit (col1 float, col2 float) partition by column(key float8) as
 select
   sum(l_orderkey) as total1,
   avg(l_partkey) as total2,

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
index e9ab88d..686d2e1 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
@@ -1,4 +1,4 @@
-create table testCtasWithOrderby (col1 int4, col2 int4) partition by column(key float8) as
+create table testCtasWithOrderby (col1 float, col2 float) partition by column(key float8) as
 select
   sum(l_orderkey) as total1,
   avg(l_partkey) as total2,

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
index c9d6888..739f23f 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
@@ -1,4 +1,4 @@
-create table testCtasWithUnion (col1 int4, col2 int4) partition by column(key float8) as
+create table testCtasWithUnion (col1 float, col2 float) partition by column(key float8) as
 
 select
   *

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
index d5f89d6..76b852a 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
@@ -1,2 +1,2 @@
-create table testCtasWithColumnedPartition (col1 int4, col2 int4) partition by column(key float8) as
+create table testCtasWithColumnedPartition (col1 float, col2 float) partition by column(key float8) as
 select l_orderkey as col1, l_partkey as col2, l_quantity as key from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
index fe96e14..048902f 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
@@ -1,7 +1,7 @@
 col1,col2,key
 -------------------------------
-1,0,17.0
-1,0,36.0
-2,0,38.0
-3,0,45.0
-3,0,49.0
\ No newline at end of file
+1.0,1.0,17.0
+1.0,1.0,36.0
+2.0,2.0,38.0
+3.0,2.0,45.0
+3.0,3.0,49.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithLimit.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithLimit.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithLimit.result
index b9bc210..ea78854 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithLimit.result
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithLimit.result
@@ -1,5 +1,5 @@
 col1,col2,key
 -------------------------------
-1,0,17.0
-1,0,36.0
-2,0,38.0
\ No newline at end of file
+1.0,1.0,17.0
+1.0,1.0,36.0
+2.0,2.0,38.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
index fe96e14..048902f 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
@@ -1,7 +1,7 @@
 col1,col2,key
 -------------------------------
-1,0,17.0
-1,0,36.0
-2,0,38.0
-3,0,45.0
-3,0,49.0
\ No newline at end of file
+1.0,1.0,17.0
+1.0,1.0,36.0
+2.0,2.0,38.0
+3.0,2.0,45.0
+3.0,3.0,49.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/9de88cb9/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java b/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java
index 07ea79b..de73a3a 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java
@@ -121,11 +121,11 @@ public class TextSerializerDeserializer implements SerializerDeserializer {
         break;
       case INT2:
         datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get()
-            : DatumFactory.createInt2(new String(bytes, offset, length));
+            : DatumFactory.createInt2((short) Bytes.parseInt(bytes, offset, length));
         break;
       case INT4:
         datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get()
-            : DatumFactory.createInt4(new String(bytes, offset, length));
+            : DatumFactory.createInt4(Bytes.parseInt(bytes, offset, length));
         break;
       case INT8:
         datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get()
@@ -137,7 +137,7 @@ public class TextSerializerDeserializer implements SerializerDeserializer {
         break;
       case FLOAT8:
         datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get()
-            : DatumFactory.createFloat8(new String(bytes, offset, length));
+            : DatumFactory.createFloat8(Bytes.parseDouble(bytes, offset, length));
         break;
       case TEXT: {
         byte[] chars = new byte[length];