tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject tajo git commit: TAJO-1608: Fix test failure in index_support branch. (jihoon)
Date Tue, 19 May 2015 02:54:15 GMT
Repository: tajo
Updated Branches:
  refs/heads/index_support 2cbc1b9c7 -> 1ad6b6cc9


TAJO-1608: Fix test failure in index_support branch. (jihoon)

Closes #573


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

Branch: refs/heads/index_support
Commit: 1ad6b6cc9d01760c66fd332bf7d0a246dce5ee1a
Parents: 2cbc1b9
Author: Jihoon Son <jihoonson@apache.org>
Authored: Tue May 19 11:52:40 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Tue May 19 11:53:44 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |   2 +
 .../engine/planner/PhysicalPlannerImpl.java     |   7 +-
 .../planner/physical/BSTIndexScanExec.java      | 114 +++++++++++++++----
 .../apache/tajo/engine/query/TestIndexScan.java |  94 +++++++++------
 .../org/apache/tajo/storage/StorageManager.java |  16 +++
 .../org/apache/tajo/storage/TableSpace.java     |   3 +
 .../apache/tajo/storage/TableSpaceManager.java  |  16 ---
 .../apache/tajo/storage/FileStorageManager.java |  20 ----
 .../apache/tajo/storage/index/TestBSTIndex.java |  48 +++++---
 9 files changed, 208 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 4372e04..b2b457c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -128,6 +128,8 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1608: Fix test failure in index_support branch. (jihoon)
+
     TAJO-1594: Catalog schema is invalid for some databases. (jihoon)
 
     TAJO-1605: Fix master build failure on jdk 1.6. (jinho)

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
index 04315eb..2f46026 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
@@ -1192,11 +1192,10 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
     Preconditions.checkNotNull(ctx.getTable(annotation.getCanonicalName()),
         "Error: There is no table matched to %s", annotation.getCanonicalName());
 
-    FragmentProto [] fragmentProtos = ctx.getTables(annotation.getTableName());
-    List<FileFragment> fragments =
-        FragmentConvertor.convert(ctx.getConf(), fragmentProtos);
+    FragmentProto [] fragments = ctx.getTables(annotation.getTableName());
 
-    return new BSTIndexScanExec(ctx, annotation, fragments.get(0), annotation.getIndexPath(),
+    Preconditions.checkState(fragments.length == 1);
+    return new BSTIndexScanExec(ctx, annotation, fragments[0], annotation.getIndexPath(),
         annotation.getKeySchema(), annotation.getPredicates());
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/BSTIndexScanExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/BSTIndexScanExec.java
b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/BSTIndexScanExec.java
index 7df48a4..712fc6d 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/BSTIndexScanExec.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/BSTIndexScanExec.java
@@ -25,6 +25,8 @@ import org.apache.hadoop.io.IOUtils;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.engine.planner.Projector;
@@ -33,19 +35,22 @@ import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.expr.EvalTreeUtil;
 import org.apache.tajo.plan.logical.IndexScanNode;
 import org.apache.tajo.plan.rewrite.rules.IndexScanInfo.SimplePredicate;
+import org.apache.tajo.plan.util.PlannerUtil;
 import org.apache.tajo.storage.*;
 import org.apache.tajo.storage.fragment.FileFragment;
+import org.apache.tajo.storage.fragment.FragmentConvertor;
 import org.apache.tajo.storage.index.bst.BSTIndex;
 import org.apache.tajo.util.TUtil;
 import org.apache.tajo.worker.TaskAttemptContext;
 
 import java.io.IOException;
 import java.net.URI;
+import java.util.HashSet;
 import java.util.Set;
 
 public class BSTIndexScanExec extends PhysicalExec {
   private final static Log LOG = LogFactory.getLog(BSTIndexScanExec.class);
-  private IndexScanNode scanNode;
+  private IndexScanNode plan;
   private SeekableScanner fileScanner;
   
   private EvalNode qual;
@@ -61,13 +66,18 @@ public class BSTIndexScanExec extends PhysicalExec {
 
   private TableStats inputStats;
 
-  public BSTIndexScanExec(TaskAttemptContext context,
-                          IndexScanNode scanNode ,
-       FileFragment fragment, URI indexPrefix , Schema keySchema,
-       SimplePredicate [] predicates) throws IOException {
-    super(context, scanNode.getInSchema(), scanNode.getOutSchema());
-    this.scanNode = scanNode;
-    this.qual = scanNode.getQual();
+  private CatalogProtos.FragmentProto fragment;
+
+  private Schema keySchema;
+
+  public BSTIndexScanExec(TaskAttemptContext context, IndexScanNode plan,
+                          CatalogProtos.FragmentProto fragment, URI indexPrefix , Schema
keySchema,
+                          SimplePredicate [] predicates) throws IOException {
+    super(context, plan.getInSchema(), plan.getOutSchema());
+    this.plan = plan;
+    this.qual = plan.getQual();
+    this.fragment = fragment;
+    this.keySchema = keySchema;
 
     SortSpec[] keySortSpecs = new SortSpec[predicates.length];
     values = new Datum[predicates.length];
@@ -79,12 +89,8 @@ public class BSTIndexScanExec extends PhysicalExec {
     TupleComparator comparator = new BaseTupleComparator(keySchema,
         keySortSpecs);
 
-    Schema fileScanOutSchema = mergeSubSchemas(inSchema, keySchema, scanNode.getTargets(),
qual);
 
-    this.fileScanner = TableSpaceManager.getSeekableScanner(context.getConf(),
-        scanNode.getTableDesc().getMeta(), inSchema, fragment, fileScanOutSchema);
-    this.fileScanner.init();
-    this.projector = new Projector(context, inSchema, outSchema, scanNode.getTargets());
+    this.projector = new Projector(context, inSchema, outSchema, plan.getTargets());
 
     Path indexPath = new Path(indexPrefix.toString(), context.getUniqueKeyFromFragments());
     this.reader = new BSTIndex(context.getConf()).
@@ -111,10 +117,79 @@ public class BSTIndexScanExec extends PhysicalExec {
 
   @Override
   public void init() throws IOException {
+    Schema projected;
+
+    // in the case where projected column or expression are given
+    // the target can be an empty list.
+    if (plan.hasTargets()) {
+      projected = new Schema();
+      Set<Column> columnSet = new HashSet<Column>();
+
+      if (plan.hasQual()) {
+        columnSet.addAll(EvalTreeUtil.findUniqueColumns(qual));
+      }
+
+      for (Target t : plan.getTargets()) {
+        columnSet.addAll(EvalTreeUtil.findUniqueColumns(t.getEvalTree()));
+      }
+
+      for (Column column : inSchema.getAllColumns()) {
+        if (columnSet.contains(column)) {
+          projected.addColumn(column);
+        }
+      }
+
+    } else {
+      // no any projected columns, meaning that all columns should be projected.
+      // TODO - this implicit rule makes code readability bad. So, we should remove it later
+      projected = outSchema;
+    }
+
+    initScanner(projected);
     super.init();
     progress = 0.0f;
-    if (qual != null) {
-      qual.bind(context.getEvalContext(), inSchema);
+
+    if (plan.hasQual()) {
+      if (fileScanner.isProjectable()) {
+        qual.bind(context.getEvalContext(), projected);
+      } else {
+        qual.bind(context.getEvalContext(), inSchema);
+      }
+    }
+  }
+
+  private void initScanner(Schema projected) throws IOException {
+
+    TableMeta meta;
+    try {
+      meta = (TableMeta) plan.getTableDesc().getMeta().clone();
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e);
+    }
+
+    // set system default properties
+    PlannerUtil.applySystemDefaultToTableProperties(context.getQueryContext(), meta);
+
+    // Why we should check nullity? See https://issues.apache.org/jira/browse/TAJO-1422
+    if (fragment != null) {
+
+      Schema fileScanOutSchema = mergeSubSchemas(projected, keySchema, plan.getTargets(),
qual);
+
+      this.fileScanner = TableSpaceManager.getStorageManager(context.getConf(),
+          plan.getTableDesc().getMeta().getStoreType())
+          .getSeekableScanner(plan.getTableDesc().getMeta(), plan.getPhysicalSchema(), fragment,
fileScanOutSchema);
+      this.fileScanner.init();
+
+      // See Scanner.isProjectable() method Depending on the result of isProjectable(),
+      // the width of retrieved tuple is changed.
+      //
+      // If TRUE, the retrieved tuple will contain only projected fields.
+      // If FALSE, the retrieved tuple will contain projected fields and NullDatum for non-projected
fields.
+      if (fileScanner.isProjectable()) {
+        this.projector = new Projector(context, projected, outSchema, plan.getTargets());
+      } else {
+        this.projector = new Projector(context, inSchema, outSchema, plan.getTargets());
+      }
     }
   }
 
@@ -146,9 +221,10 @@ public class BSTIndexScanExec extends PhysicalExec {
       fileScanner.seek(offset);
       }
     }
+
     Tuple tuple;
-    Tuple outTuple = new VTuple(this.outSchema.size());
-    if (!scanNode.hasQual()) {
+    Tuple outTuple = new VTuple(outColumnNum);
+    if (!plan.hasQual()) {
       if ((tuple = fileScanner.next()) != null) {
         projector.eval(tuple, outTuple);
         return outTuple;
@@ -166,7 +242,6 @@ public class BSTIndexScanExec extends PhysicalExec {
              return null;
            }
            else fileScanner.seek(offset);
-           return null;
          }
        }
      }
@@ -193,9 +268,6 @@ public class BSTIndexScanExec extends PhysicalExec {
     }
     reader = null;
     fileScanner = null;
-    scanNode = null;
-    qual = null;
-    projector = null;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
index f94a3b5..3a4ff6f 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
@@ -44,76 +44,100 @@ public class TestIndexScan extends QueryTestCaseBase {
   @Test
   public final void testOnSortedNonUniqueKeys() throws Exception {
     executeString("create index l_orderkey_idx on lineitem (l_orderkey)");
-    ResultSet res = executeString("select * from lineitem where l_orderkey = 1;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_orderkey_idx");
+    try {
+      ResultSet res = executeString("select * from lineitem where l_orderkey = 1;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_orderkey_idx");
+    }
   }
 
   @Test
   public final void testOnUnsortedTextKeys() throws Exception {
     executeString("create index l_shipdate_idx on lineitem (l_shipdate)");
-    ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
where l_shipdate = '1997-01-28';");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_shipdate_idx");
+    try {
+      ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
where l_shipdate = '1997-01-28';");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_shipdate_idx");
+    }
   }
 
   @Test
   public final void testOnMultipleKeys() throws Exception {
     executeString("create index multikey_idx on lineitem (l_shipdate asc null last, l_tax
desc null first, l_shipmode, l_linenumber desc null last)");
-    ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
" +
-        "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 'RAIL' and l_linenumber
= 1;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index multikey_idx");
+    try {
+      ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
" +
+          "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 'RAIL' and l_linenumber
= 1;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index multikey_idx");
+    }
   }
 
   @Test
   public final void testOnMultipleKeys2() throws Exception {
     executeString("create index multikey_idx on lineitem (l_shipdate asc null last, l_tax
desc null first)");
-    ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
" +
-        "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 'RAIL' and l_linenumber
= 1;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index multikey_idx");
+    try {
+      ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment from lineitem
" +
+          "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 'RAIL' and l_linenumber
= 1;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index multikey_idx");
+    }
   }
 
   @Test
   public final void testOnMultipleExprs() throws Exception {
     executeString("create index l_orderkey_100_l_linenumber_10_idx on lineitem (l_orderkey*100-l_linenumber*10
asc null first);");
-    ResultSet res = executeString("select l_orderkey, l_linenumber from lineitem where l_orderkey*100-l_linenumber*10
= 280");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_orderkey_100_l_linenumber_10_idx");
+    try {
+      ResultSet res = executeString("select l_orderkey, l_linenumber from lineitem where
l_orderkey*100-l_linenumber*10 = 280");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_orderkey_100_l_linenumber_10_idx");
+    }
   }
 
   @Test
   public final void testWithGroupBy() throws Exception {
     executeString("create index l_shipdate_idx on lineitem (l_shipdate)");
-    ResultSet res = executeString("select l_shipdate, count(*) from lineitem where l_shipdate
= '1997-01-28' group by l_shipdate;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_shipdate_idx");
+    try {
+      ResultSet res = executeString("select l_shipdate, count(*) from lineitem where l_shipdate
= '1997-01-28' group by l_shipdate;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_shipdate_idx");
+    }
   }
 
   @Test
   public final void testWithSort() throws Exception {
     executeString("create index l_orderkey_idx on lineitem (l_orderkey)");
-    ResultSet res = executeString("select l_shipdate from lineitem where l_orderkey = 1 order
by l_shipdate;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_orderkey_idx");
+    try {
+      ResultSet res = executeString("select l_shipdate from lineitem where l_orderkey = 1
order by l_shipdate;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_orderkey_idx");
+    }
   }
 
   @Test
   public final void testWithJoin() throws Exception {
     executeString("create index l_orderkey_idx on lineitem (l_orderkey)");
     executeString("create index o_orderkey_idx on orders (o_orderkey)");
-    ResultSet res = executeString("select l_shipdate, o_orderstatus from lineitem, orders
where l_orderkey = o_orderkey and l_orderkey = 1 and o_orderkey = 1;");
-    assertResultSet(res);
-    cleanupQuery(res);
-    executeString("drop index l_orderkey_idx");
-    executeString("drop index o_orderkey_idx");
+    try {
+      ResultSet res = executeString("select l_shipdate, o_orderstatus from lineitem, orders
where l_orderkey = o_orderkey and l_orderkey = 1 and o_orderkey = 1;");
+      assertResultSet(res);
+      cleanupQuery(res);
+    } finally {
+      executeString("drop index l_orderkey_idx");
+      executeString("drop index o_orderkey_idx");
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
index 0751035..ca6dab5 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
@@ -254,6 +254,22 @@ public abstract class StorageManager implements TableSpace {
   }
 
   /**
+   * Returns Scanner instance.
+   *
+   * @param meta The table meta
+   * @param schema The input schema
+   * @param fragment The fragment for scanning
+   * @param target The output schema
+   * @return Scanner instance
+   * @throws IOException
+   */
+  @Override
+  public synchronized SeekableScanner getSeekableScanner(TableMeta meta, Schema schema, FragmentProto
fragment,
+                                                         Schema target) throws IOException
{
+    return (SeekableScanner)this.getScanner(meta, schema, fragment, target);
+  }
+
+  /**
    * Returns Appender instance.
    * @param queryContext Query property.
    * @param taskAttemptId Task id.

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpace.java
b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpace.java
index ef4aa9a..c6c5b6c 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpace.java
@@ -62,6 +62,9 @@ public interface TableSpace extends Closeable {
 
   Scanner getScanner(TableMeta meta, Schema schema, Fragment fragment, Schema target) throws
IOException;
 
+  SeekableScanner getSeekableScanner(TableMeta meta, Schema schema, CatalogProtos.FragmentProto
fragment, Schema target)
+      throws IOException;
+
   Path commitOutputData(OverridableConf queryContext, ExecutionBlockId finalEbId,
                                LogicalPlan plan, Schema schema,
                                TableDesc tableDesc) throws IOException;

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpaceManager.java
b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpaceManager.java
index 42a5e07..2543c9a 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TableSpaceManager.java
@@ -178,22 +178,6 @@ public class TableSpaceManager {
   }
 
   /**
-   * Returns Scanner instance.
-   *
-   * @param conf The system property
-   * @param meta The table meta
-   * @param schema The input schema
-   * @param fragment The fragment for scanning
-   * @param target The output schema
-   * @return Scanner instance
-   * @throws IOException
-   */
-  public static synchronized SeekableScanner getSeekableScanner(
-      TajoConf conf, TableMeta meta, Schema schema, Fragment fragment, Schema target) throws
IOException {
-    return (SeekableScanner)getStorageManager(conf, meta.getStoreType()).getScanner(meta,
schema, fragment, target);
-  }
-
-  /**
    * Creates a scanner instance.
    *
    * @param theClass Concrete class of scanner

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileStorageManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileStorageManager.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileStorageManager.java
index 4efc3b7..bdaa832 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileStorageManager.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileStorageManager.java
@@ -890,26 +890,6 @@ public class FileStorageManager extends StorageManager {
   }
 
   /**
-   * Returns Scanner instance.
-   *
-   * @param conf The system property
-   * @param meta The table meta
-   * @param schema The input schema
-   * @param path The data file path
-   * @return Scanner instance
-   * @throws java.io.IOException
-   */
-  public static synchronized SeekableScanner getSeekableScanner(
-      TajoConf conf, TableMeta meta, Schema schema, Path path) throws IOException {
-
-    FileSystem fs = path.getFileSystem(conf);
-    FileStatus status = fs.getFileStatus(path);
-    FileFragment fragment = new FileFragment(path.getName(), path, 0, status.getLen());
-
-    return TableSpaceManager.getSeekableScanner(conf, meta, schema, fragment, schema);
-  }
-
-  /**
    * Finalizes result data. Tajo stores result data in the staging directory.
    * If the query fails, clean up the staging directory.
    * Otherwise the query is successful, move to the final directory from the staging directory.

http://git-wip-us.apache.org/repos/asf/tajo/blob/1ad6b6cc/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
index ae0fd58..e021bfb 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/index/TestBSTIndex.java
@@ -124,7 +124,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -147,7 +148,8 @@ public class TestBSTIndex {
     tuple = new VTuple(keySchema.size());
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindValue_" + storeType
+ ".idx"), keySchema, comp);
     reader.open();
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     for (int i = 0; i < TUPLE_NUM - 1; i++) {
@@ -226,7 +228,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testBuildIndexWithAppender_"
+ storeType + ".idx"),
         keySchema, comp);
     reader.open();
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     for (int i = 0; i < TUPLE_NUM - 1; i++) {
@@ -289,7 +292,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -360,7 +364,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -383,7 +388,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindNextKeyValue_"
+ storeType + ".idx"),
         keySchema, comp);
     reader.open();
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple result;
@@ -451,7 +457,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -474,7 +481,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindNextKeyOmittedValue_"
+ storeType + ".idx"),
         keySchema, comp);
     reader.open();
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple result;
@@ -530,7 +538,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -555,7 +564,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindMinValue_" + storeType
+ ".idx"),
         keySchema, comp);
     reader.open();
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     tuple.put(0, DatumFactory.createInt8(0));
@@ -613,7 +623,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -718,7 +729,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -799,7 +811,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -824,7 +837,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "testFindValueDescOrder_"
+ storeType + ".idx"),
         keySchema, comp);
     reader.open();
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     for (int i = (TUPLE_NUM - 1); i > 0; i--) {
@@ -889,7 +903,8 @@ public class TestBSTIndex {
     creater.setLoadNum(LOAD_NUM);
     creater.open();
 
-    SeekableScanner scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet,
schema);
+    SeekableScanner scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple keyTuple;
@@ -917,7 +932,8 @@ public class TestBSTIndex {
     assertEquals(keySchema, reader.getKeySchema());
     assertEquals(comp, reader.getComparator());
 
-    scanner = TableSpaceManager.getSeekableScanner(conf, meta, schema, tablet, schema);
+    scanner = TableSpaceManager.getStorageManager(conf, meta.getStoreType()).
+        getSeekableScanner(meta, schema, tablet.getProto(), schema);
     scanner.init();
 
     Tuple result;


Mime
View raw message