Repository: tajo
Updated Branches:
  refs/heads/master 8b5361a06 -> 631f3d04a


http://git-wip-us.apache.org/repos/asf/tajo/blob/631f3d04/tajo-storage/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
----------------------------------------------------------------------
diff --git 
a/tajo-storage/src/main/java/org/apache/tajo/storage/RowStoreUtil.java 
b/tajo-storage/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
index 66d016b..b64bfe1 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
@@ -46,16 +46,20 @@ public class RowStoreUtil {
     return out;
   }
 
+  public static RowStoreEncoder createEncoder(Schema schema) {
+    return new RowStoreEncoder(schema);
+  }
+
+  public static RowStoreDecoder createDecoder(Schema schema) {
+    return new RowStoreDecoder(schema);
+  }
+
   public static class RowStoreDecoder {
 
     private Schema schema;
     private BitArray nullFlags;
     private int headerSize;
 
-    public static RowStoreDecoder createInstance(Schema schema) {
-      return new RowStoreDecoder(schema);
-    }
-
     private RowStoreDecoder(Schema schema) {
       this.schema = schema;
       nullFlags = new BitArray(schema.size());
@@ -156,10 +160,6 @@ public class RowStoreUtil {
     private BitArray nullFlags;
     private int headerSize;
 
-    public static RowStoreEncoder createInstance(Schema schema) {
-      return new RowStoreEncoder(schema);
-    }
-
     private RowStoreEncoder(Schema schema) {
       this.schema = schema;
       nullFlags = new BitArray(schema.size());
@@ -167,8 +167,8 @@ public class RowStoreUtil {
     }
     public byte [] toBytes(Tuple tuple) {
       nullFlags.clear();
-      int size = StorageUtil.getRowByteSize(schema);
-      ByteBuffer bb = ByteBuffer.allocate(size+headerSize);
+      int size = 4096; // 4kb
+      ByteBuffer bb = ByteBuffer.allocate(size + headerSize);
       bb.position(headerSize);
       Column col;
       for (int i = 0; i < schema.size(); i++) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/631f3d04/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
----------------------------------------------------------------------
diff --git 
a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java 
b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
index b149584..2ae04d5 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.proto.CatalogProtos.SchemaProto;
+import org.apache.tajo.storage.RowStoreUtil;
 import org.apache.tajo.storage.RowStoreUtil.RowStoreDecoder;
 import org.apache.tajo.storage.RowStoreUtil.RowStoreEncoder;
 import org.apache.tajo.storage.Tuple;
@@ -113,7 +114,7 @@ public class BSTIndex implements IndexMethod {
       this.keySchema = keySchema;
       this.compartor = comparator;
       this.collector = new KeyOffsetCollector(comparator);
-      this.rowStoreEncoder = RowStoreEncoder.createInstance(keySchema);
+      this.rowStoreEncoder = RowStoreUtil.createEncoder(keySchema);
     }
 
    public void setLoadNum(int loadNum) {
@@ -315,7 +316,7 @@ public class BSTIndex implements IndexMethod {
       this.fileName = fileName;
       this.keySchema = keySchema;
       this.comparator = comparator;
-      this.rowStoreDecoder = RowStoreDecoder.createInstance(keySchema);
+      this.rowStoreDecoder = RowStoreUtil.createDecoder(keySchema);
     }
 
     public BSTIndexReader(final Path fileName) throws IOException {
@@ -340,7 +341,7 @@ public class BSTIndex implements IndexMethod {
       builder.mergeFrom(schemaBytes);
       SchemaProto proto = builder.build();
       this.keySchema = new Schema(proto);
-      this.rowStoreDecoder = RowStoreDecoder.createInstance(keySchema);
+      this.rowStoreDecoder = RowStoreUtil.createDecoder(keySchema);
 
       // comparator
       int compByteSize = indexIn.readInt();

Reply via email to