?? lookupplan.java
字號:
package simpledb.index.query;import simpledb.record.Schema;import simpledb.query.*;/** * The Plan class for the <i>lookup</i> relational algebra operator. * @author Edward Sciore * */public class LookupPlan implements Plan { private Plan rp, tp; private Schema sch = new Schema(); /** * Creates a new lookup node having the specified * LHS rid-table and RHS data table. * @param rp the LHS rid-table * @param tp the RHS table */ public LookupPlan(Plan rp, Plan tp) { this.rp = rp; this.tp = tp; sch.addAll(rp.schema()); sch.addAll(tp.schema()); } /** * Creates a new lookup scan for this query. * @see simpledb.query.Plan#open() */ public Scan open() { RidScan rs = (RidScan) rp.open(); TableScan ts = (TableScan) tp.open(); return new LookupScan(rs, ts); } /** * Estimates the number of block accesses to compute the * lookup, which is the sum of the costs of its * LHS and RHS. * @see simpledb.query.Plan#blocksAccessed() */ public int blocksAccessed() { return rp.blocksAccessed() + rp.recordsOutput(); } /** * Estimates the number of output records in the lookup, * which is the same as in the LHS rid-table. * @see simpledb.query.Plan#recordsOutput() */ public int recordsOutput() { return rp.recordsOutput(); } /** * Estimate the number of distinct values for the * specified field. * This value is the same as in the LHS or RHS, * depending on where the field came from. * @see simpledb.query.Plan#distinctValues(java.lang.String) */ public int distinctValues(String fldname) { if (rp.schema().hasField(fldname)) return rp.distinctValues(fldname); else return tp.distinctValues(fldname); } /** * Returns the union of the LHS and RHS schemas. * @see simpledb.query.Plan#schema() */ public Schema schema() { return sch; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -