?? indexselectplan.java
字號:
package simpledb.index.query;import simpledb.tx.Transaction;import simpledb.record.Schema;import simpledb.query.*;import simpledb.index.Index;import simpledb.index.metadata.IndexInfo;/** The Plan class corresponding to the <i>indexselect</i> * relational algebra operator. * @author Edward Sciore */public class IndexSelectPlan implements Plan { private IndexInfo ii; private Constant val; /** * Creates a new indexselect node in the query tree * for the specified index and selection constant. * @param ii information about the index * @param val the selection constant * @param tx the calling transaction */ public IndexSelectPlan(IndexInfo ii, Constant val, Transaction tx) { this.ii = ii; this.val = val; } /** * Creates a new indexselect scan for this query * @see simpledb.query.Plan#open() */ public Scan open() { Index idx = ii.open(); return new IndexSelectScan(idx, val); } /** * Estimates the number of block accesses to compute the * index selection, which is the same as the * index traversal cost. * @see simpledb.query.Plan#blocksAccessed() */ public int blocksAccessed() { return ii.blocksAccessed(); } /** * Estimates the number of output records in the index selection, * which is the same as the number of search key values * for the index. * @see simpledb.query.Plan#recordsOutput() */ public int recordsOutput() { return ii.recordsOutput(); } /** * This method should never be called, * because there are no interesting fields in the index. * @see simpledb.query.Plan#distinctValues(java.lang.String) */ public int distinctValues(String fname) { throw new RuntimeException("field " + fname + " not found."); } /** * Returns an empty schema, because there are no * interesting fields in the index. * @see simpledb.query.Plan#schema() */ public Schema schema() { return new Schema(); // i.e. return an empty schema }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -