tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [1/3] TAJO-610: Refactor Column class.
Date Thu, 20 Feb 2014 11:10:30 GMT
Repository: incubator-tajo
Updated Branches:
  refs/heads/master e63f4b09f -> e2f4798b0


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
index 1151a0a..5c29928 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/RawFile.java
@@ -91,8 +91,8 @@ public class RawFile {
 
       buffer = ByteBuffer.allocateDirect(128 * 1024);
 
-      columnTypes = new DataType[schema.getColumnNum()];
-      for (int i = 0; i < schema.getColumnNum(); i++) {
+      columnTypes = new DataType[schema.size()];
+      for (int i = 0; i < schema.size(); i++) {
         columnTypes[i] = schema.getColumn(i).getDataType();
       }
 
@@ -102,7 +102,7 @@ public class RawFile {
       channel.read(buffer);
       buffer.flip();
 
-      nullFlags = new BitArray(schema.getColumnNum());
+      nullFlags = new BitArray(schema.size());
       headerSize = RECORD_SIZE + 2 + nullFlags.bytesLength();
 
       super.init();
@@ -423,8 +423,8 @@ public class RawFile {
       channel = randomAccessFile.getChannel();
       pos = 0;
 
-      columnTypes = new DataType[schema.getColumnNum()];
-      for (int i = 0; i < schema.getColumnNum(); i++) {
+      columnTypes = new DataType[schema.size()];
+      for (int i = 0; i < schema.size(); i++) {
         columnTypes[i] = schema.getColumn(i).getDataType();
       }
 
@@ -432,7 +432,7 @@ public class RawFile {
 
       // comput the number of bytes, representing the null flags
 
-      nullFlags = new BitArray(schema.getColumnNum());
+      nullFlags = new BitArray(schema.size());
       headerSize = RECORD_SIZE + 2 + nullFlags.bytesLength();
 
       if (enabledStats) {
@@ -559,7 +559,7 @@ public class RawFile {
       buffer.position(recordOffset + headerSize);
       // reset the null flags
       nullFlags.clear();
-      for (int i = 0; i < schema.getColumnNum(); i++) {
+      for (int i = 0; i < schema.size(); i++) {
         if (enabledStats) {
           stats.analyzeField(i, t.get(i));
         }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java
index 954eb54..30c321c 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java
@@ -75,7 +75,7 @@ public class RowFile {
           conf.getInt(ConfVars.RAWFILE_SYNC_INTERVAL.varname,
               SYNC_SIZE * 100);
 
-      nullFlags = new BitArray(schema.getColumnNum());
+      nullFlags = new BitArray(schema.size());
       tupleHeaderSize = nullFlags.bytesLength() + (2 * Short.SIZE / 8);
       this.start = fragment.getStartKey();
       this.end = this.start + fragment.getEndKey();
@@ -85,7 +85,7 @@ public class RowFile {
       // set default page size.
       fs = fragment.getPath().getFileSystem(conf);
       in = fs.open(fragment.getPath());
-      buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE * schema.getColumnNum());
+      buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE * schema.size());
       buffer.flip();
 
       readHeader();
@@ -180,7 +180,7 @@ public class RowFile {
       }
 
       int i;
-      tuple = new VTuple(schema.getColumnNum());
+      tuple = new VTuple(schema.size());
 
       int nullFlagSize = buffer.getShort();
       byte[] nullFlagBytes = new byte[nullFlagSize];
@@ -196,7 +196,7 @@ public class RowFile {
 
       Datum datum;
       Column col;
-      for (i = 0; i < schema.getColumnNum(); i++) {
+      for (i = 0; i < schema.size(); i++) {
         if (!nullFlags.get(i)) {
           col = schema.getColumn(i);
           switch (col.getDataType().getType()) {
@@ -351,7 +351,7 @@ public class RowFile {
 
       buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE);
 
-      nullFlags = new BitArray(schema.getColumnNum());
+      nullFlags = new BitArray(schema.size());
 
       if (enabledStats) {
         this.stats = new TableStatistics(this.schema);
@@ -373,7 +373,7 @@ public class RowFile {
       buffer.clear();
       nullFlags.clear();
 
-      for (int i = 0; i < schema.getColumnNum(); i++) {
+      for (int i = 0; i < schema.size(); i++) {
         if (enabledStats) {
           stats.analyzeField(i, t.get(i));
         }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/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 b0cb09d..7a421a8 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
@@ -28,7 +28,7 @@ import java.nio.ByteBuffer;
 
 public class RowStoreUtil {
   public static int[] getTargetIds(Schema inSchema, Schema outSchema) {
-    int[] targetIds = new int[outSchema.getColumnNum()];
+    int[] targetIds = new int[outSchema.size()];
     int i = 0;
     for (Column target : outSchema.getColumns()) {
       targetIds[i] = inSchema.getColumnId(target.getQualifiedName());
@@ -50,10 +50,10 @@ public class RowStoreUtil {
 
     public static Tuple toTuple(Schema schema, byte [] bytes) {
       ByteBuffer bb = ByteBuffer.wrap(bytes);
-      Tuple tuple = new VTuple(schema.getColumnNum());
+      Tuple tuple = new VTuple(schema.size());
       Column col;
       TajoDataTypes.DataType type;
-      for (int i =0; i < schema.getColumnNum(); i++) {
+      for (int i =0; i < schema.size(); i++) {
         col = schema.getColumn(i);
         type = col.getDataType();
         switch (type.getType()) {
@@ -164,7 +164,7 @@ public class RowStoreUtil {
       int size = StorageUtil.getRowByteSize(schema);
       ByteBuffer bb = ByteBuffer.allocate(size);
       Column col;
-      for (int i = 0; i < schema.getColumnNum(); i++) {
+      for (int i = 0; i < schema.size(); i++) {
         col = schema.getColumn(i);
         switch (col.getDataType().getType()) {
           case BOOLEAN: bb.put(tuple.get(i).asByte()); break;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/TableStatistics.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/TableStatistics.java b/tajo-storage/src/main/java/org/apache/tajo/storage/TableStatistics.java
index 41c9d61..cbee95e 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/TableStatistics.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/TableStatistics.java
@@ -42,14 +42,14 @@ public class TableStatistics {
 
   public TableStatistics(Schema schema) {
     this.schema = schema;
-    minValues = new VTuple(schema.getColumnNum());
-    maxValues = new VTuple(schema.getColumnNum());
+    minValues = new VTuple(schema.size());
+    maxValues = new VTuple(schema.size());
 
-    numNulls = new long[schema.getColumnNum()];
-    comparable = new boolean[schema.getColumnNum()];
+    numNulls = new long[schema.size()];
+    comparable = new boolean[schema.size()];
 
     DataType type;
-    for (int i = 0; i < schema.getColumnNum(); i++) {
+    for (int i = 0; i < schema.size(); i++) {
       type = schema.getColumn(i).getDataType();
       if (type.getType() == Type.PROTOBUF) {
         comparable[i] = false;
@@ -101,7 +101,7 @@ public class TableStatistics {
     TableStats stat = new TableStats();
 
     ColumnStats columnStats;
-    for (int i = 0; i < schema.getColumnNum(); i++) {
+    for (int i = 0; i < schema.size(); i++) {
       columnStats = new ColumnStats(schema.getColumn(i));
       columnStats.setNumNulls(numNulls[i]);
       columnStats.setMinValue(minValues.get(i));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java
index a6b8781..afbcaa8 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java
@@ -705,7 +705,7 @@ public class RCFile {
 
       RECORD_INTERVAL = conf.getInt(RECORD_INTERVAL_CONF_STR, RECORD_INTERVAL);
       COLUMNS_BUFFER_SIZE = conf.getInt(COLUMNS_BUFFER_SIZE_CONF_STR, COLUMNS_BUFFER_SIZE);
-      columnNumber = schema.getColumnNum();
+      columnNumber = schema.size();
     }
 
     public void init() throws IOException {
@@ -867,7 +867,7 @@ public class RCFile {
      * @throws IOException
      */
     public void append(Tuple tuple) throws IOException {
-      int size = schema.getColumnNum();
+      int size = schema.size();
 
       for (int i = 0; i < size; i++) {
         Datum datum = tuple.get(i);
@@ -1179,7 +1179,7 @@ public class RCFile {
 
       targetColumnIndexes = new int[targets.length];
       for (int i = 0; i < targets.length; i++) {
-        targetColumnIndexes[i] = schema.getColumnIdByName(targets[i].getColumnName());
+        targetColumnIndexes[i] = schema.getColumnIdByName(targets[i].getSimpleName());
       }
       Arrays.sort(targetColumnIndexes);
 
@@ -1592,7 +1592,7 @@ public class RCFile {
         return null;
       }
 
-      Tuple tuple = new VTuple(schema.getColumnNum());
+      Tuple tuple = new VTuple(schema.size());
       getCurrentRow(tuple);
       return tuple;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
index 3209469..2c35148 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniAppender.java
@@ -61,10 +61,10 @@ public class TrevniAppender extends FileAppender {
     fos = fs.create(path);
 
     ColumnMetaData [] trevniMetas =
-        new ColumnMetaData[schema.getColumnNum()];
+        new ColumnMetaData[schema.size()];
     int i = 0;
     for (Column column : schema.getColumns()) {
-      trevniMetas[i++] = new ColumnMetaData(column.getColumnName(),
+      trevniMetas[i++] = new ColumnMetaData(column.getSimpleName(),
           getType(column.getDataType().getType()));
     }
 
@@ -127,7 +127,7 @@ public class TrevniAppender extends FileAppender {
   public void addTuple(Tuple t) throws IOException {
     Column col;
     writer.startRow();
-    for (int i = 0; i < schema.getColumnNum(); i++) {
+    for (int i = 0; i < schema.size(); i++) {
       if (enabledStats) {
         stats.analyzeField(i, t.get(i));
       }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniScanner.java
b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniScanner.java
index 2c2037f..ed71730 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniScanner.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/trevni/TrevniScanner.java
@@ -28,9 +28,9 @@ import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.datum.NullDatum;
 import org.apache.tajo.datum.ProtobufDatumFactory;
 import org.apache.tajo.storage.FileScanner;
-import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.Tuple;
 import org.apache.tajo.storage.VTuple;
+import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.trevni.ColumnFileReader;
 import org.apache.trevni.ColumnValues;
 import org.apache.trevni.avro.HadoopInput;
@@ -71,14 +71,14 @@ public class TrevniScanner extends FileScanner {
     projectionMap = new int[targets.length];
     int tid;
     for (int i = 0; i < targets.length; i++) {
-      tid = schema.getColumnIdByName(targets[i].getColumnName());
+      tid = schema.getColumnIdByName(targets[i].getSimpleName());
       projectionMap[i] = tid;
     }
   }
 
   @Override
   public Tuple next() throws IOException {
-    Tuple tuple = new VTuple(schema.getColumnNum());
+    Tuple tuple = new VTuple(schema.size());
 
     if (!columns[0].hasNext()) {
       return null;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java
index b93672b..79ddfdd 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java
@@ -136,7 +136,7 @@ public class CSVFileScanner extends FileScannerV2 {
 
     targetColumnIndexes = new int[targets.length];
     for (int i = 0; i < targets.length; i++) {
-      targetColumnIndexes[i] = schema.getColumnIdByName(targets[i].getColumnName());
+      targetColumnIndexes[i] = schema.getColumnIdByName(targets[i].getSimpleName());
     }
 
     if (LOG.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/FileScannerV2.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/FileScannerV2.java b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/FileScannerV2.java
index 0d5b33d..f9ad2f7 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/FileScannerV2.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/FileScannerV2.java
@@ -26,9 +26,9 @@ import org.apache.hadoop.fs.Path;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableMeta;
-import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.Scanner;
 import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.storage.fragment.FileFragment;
 
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -78,7 +78,7 @@ public abstract class FileScannerV2 implements Scanner {
     this.meta = meta;
     this.schema = schema;
     this.fragment = fragment;
-    this.columnNum = this.schema.getColumnNum();
+    this.columnNum = this.schema.size();
 
     this.fs = fragment.getPath().getFileSystem(conf);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFileScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFileScanner.java b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFileScanner.java
index a549a51..5d2f861 100644
--- a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFileScanner.java
+++ b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFileScanner.java
@@ -30,7 +30,10 @@ import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.storage.*;
+import org.apache.tajo.storage.BinarySerializerDeserializer;
+import org.apache.tajo.storage.SerializerDeserializer;
+import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.storage.VTuple;
 import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.rcfile.BytesRefArrayWritable;
 import org.apache.tajo.storage.rcfile.ColumnProjectionUtils;
@@ -106,9 +109,9 @@ public class RCFileScanner extends FileScannerV2 {
   }
 
   private Tuple makeTuple() throws IOException {
-    Tuple tuple = new VTuple(schema.getColumnNum());
+    Tuple tuple = new VTuple(schema.size());
     synchronized (lock) {
-      column.resetValid(schema.getColumnNum());
+      column.resetValid(schema.size());
       int tid; // target column id
       for (int i = 0; i < projectionMap.length; i++) {
         tid = projectionMap[i];
@@ -136,7 +139,7 @@ public class RCFileScanner extends FileScannerV2 {
     projectionMap = new Integer[targets.length];
     int tid;
     for (int i = 0; i < targets.length; i++) {
-      tid = schema.getColumnIdByName(targets[i].getColumnName());
+      tid = schema.getColumnIdByName(targets[i].getSimpleName());
       projectionMap[i] = tid;
     }
     ArrayList<Integer> projectionIdList = new ArrayList<Integer>(TUtil.newList(projectionMap));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java b/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java
index 2618527..cb2f7a6 100644
--- a/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java
+++ b/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java
@@ -94,7 +94,7 @@ public class TestLazyTuple {
 
   @Test
   public void testContain() {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
 
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
     t1.put(0, DatumFactory.createInt4(1));
@@ -118,7 +118,7 @@ public class TestLazyTuple {
 
   @Test
   public void testPut() {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
     t1.put(0, DatumFactory.createText("str"));
     t1.put(1, DatumFactory.createInt4(2));
@@ -134,7 +134,7 @@ public class TestLazyTuple {
 
   @Test
   public void testEquals() {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
     LazyTuple t2 = new LazyTuple(schema, new byte[colNum][], -1);
 
@@ -161,7 +161,7 @@ public class TestLazyTuple {
 
   @Test
   public void testHashCode() {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
     LazyTuple t2 = new LazyTuple(schema, new byte[colNum][], -1);
 
@@ -195,7 +195,7 @@ public class TestLazyTuple {
 
   @Test
   public void testPutTuple() {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
 
     t1.put(0, DatumFactory.createInt4(1));
@@ -207,7 +207,7 @@ public class TestLazyTuple {
     schema2.addColumn("col1", TajoDataTypes.Type.INT8);
     schema2.addColumn("col2", TajoDataTypes.Type.INT8);
 
-    LazyTuple t2 = new LazyTuple(schema2, new byte[schema2.getColumnNum()][], -1);
+    LazyTuple t2 = new LazyTuple(schema2, new byte[schema2.size()][], -1);
     t2.put(0, DatumFactory.createInt4(4));
     t2.put(1, DatumFactory.createInt4(5));
 
@@ -238,7 +238,7 @@ public class TestLazyTuple {
 
   @Test
   public void testClone() throws CloneNotSupportedException {
-    int colNum = schema.getColumnNum();
+    int colNum = schema.size();
     LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1);
 
     t1.put(0, DatumFactory.createInt4(1));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/test/java/org/apache/tajo/storage/TestTupleComparator.java b/tajo-storage/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
index 7092953..ab7c2b2 100644
--- a/tajo-storage/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
+++ b/tajo-storage/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
@@ -18,14 +18,14 @@
 
 package org.apache.tajo.storage;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 
@@ -66,8 +66,8 @@ public class TestTupleComparator {
         DatumFactory.createInt4(4),
         DatumFactory.createText("abd")});
 
-    SortSpec sortKey1 = new SortSpec(schema.getColumnByFQN("col4"), true, false);
-    SortSpec sortKey2 = new SortSpec(schema.getColumnByFQN("col5"), true, false);
+    SortSpec sortKey1 = new SortSpec(schema.getColumn("col4"), true, false);
+    SortSpec sortKey2 = new SortSpec(schema.getColumn("col5"), true, false);
 
     TupleComparator tc = new TupleComparator(schema,
         new SortSpec[] {sortKey1, sortKey2});

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
index 34c362c..54798a4 100644
--- a/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
+++ b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
@@ -42,9 +42,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Random;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 @RunWith(Parameterized.class)
 public class TestBSTIndex {
@@ -110,8 +108,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -146,7 +144,7 @@ public class TestBSTIndex {
     creater.close();
     scanner.close();
 
-    tuple = new VTuple(keySchema.getColumnNum());
+    tuple = new VTuple(keySchema.size());
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindValue_" + storeType
+ ".idx"), keySchema, comp);
     reader.open();
     scanner = StorageManagerFactory.getSeekableScanner(conf, meta, schema, tablet, schema);
@@ -184,8 +182,8 @@ public class TestBSTIndex {
     appender.init();
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -224,7 +222,7 @@ public class TestBSTIndex {
     long fileLen = status.getLen();
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
-    tuple = new VTuple(keySchema.getColumnNum());
+    tuple = new VTuple(keySchema.size());
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testBuildIndexWithAppender_"
+ storeType + ".idx"),
         keySchema, comp);
     reader.open();
@@ -276,8 +274,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, status.getLen());
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -347,8 +345,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));
@@ -437,8 +435,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));
@@ -517,8 +515,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -551,7 +549,7 @@ public class TestBSTIndex {
     creater.close();
     scanner.close();
 
-    tuple = new VTuple(keySchema.getColumnNum());
+    tuple = new VTuple(keySchema.size());
 
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindMinValue_" + storeType
+ ".idx"),
         keySchema, comp);
@@ -599,8 +597,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));
@@ -704,8 +702,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));
@@ -784,8 +782,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), false, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), false, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), false, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), false, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -820,7 +818,7 @@ public class TestBSTIndex {
     creater.close();
     scanner.close();
 
-    tuple = new VTuple(keySchema.getColumnNum());
+    tuple = new VTuple(keySchema.size());
 
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindValueDescOrder_"
+ storeType + ".idx"),
         keySchema, comp);
@@ -875,8 +873,8 @@ public class TestBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), false, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), false, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), false, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), false, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/e2f4798b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestSingleCSVFileBSTIndex.java
----------------------------------------------------------------------
diff --git a/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestSingleCSVFileBSTIndex.java
b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestSingleCSVFileBSTIndex.java
index 6d5d90f..53a2531 100644
--- a/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestSingleCSVFileBSTIndex.java
+++ b/tajo-storage/src/test/java/org/apache/tajo/storage/index/TestSingleCSVFileBSTIndex.java
@@ -97,8 +97,8 @@ public class TestSingleCSVFileBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
 
     SortSpec[] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("long"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("double"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("long"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("long", Type.INT8));
@@ -132,7 +132,7 @@ public class TestSingleCSVFileBSTIndex {
     creater.close();
     fileScanner.close();
 
-    tuple = new VTuple(keySchema.getColumnNum());
+    tuple = new VTuple(keySchema.size());
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir,
         "FindValueInCSV.idx"), keySchema, comp);
     reader.open();
@@ -186,8 +186,8 @@ public class TestSingleCSVFileBSTIndex {
     FileFragment tablet = new FileFragment("table1_1", status.getPath(), 0, fileLen);
     
     SortSpec [] sortKeys = new SortSpec[2];
-    sortKeys[0] = new SortSpec(schema.getColumnByFQN("int"), true, false);
-    sortKeys[1] = new SortSpec(schema.getColumnByFQN("long"), true, false);
+    sortKeys[0] = new SortSpec(schema.getColumn("int"), true, false);
+    sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
     keySchema.addColumn(new Column("int", Type.INT4));


Mime
View raw message